Skip to content

Deploy to Production #151

Deploy to Production

Deploy to Production #151

name: Deploy to Production
on:
release:
types: [created]
jobs:
production_deploy:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v2
- name: push to dockerhub
uses: fylein/docker-release-action@master
id: generate-and-push-tag
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_NAME: fyle_integrations-app
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Install kustomize
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/
- name: Clone another repository
uses: actions/checkout@v2
with:
repository: ${{ vars.PROD_DEPLOY_REPO }}
ref: master
path: ${{ vars.PROD_DEPLOY_REPO }}
persist-credentials: false
token: ${{ secrets.DEPLOY_GIT_ACCESS_TOKEN }}
- name: Update Image Tag
run: |
NEW_TAG=${{ steps.generate-and-push-tag.outputs.new_tag }}
cd ${{ vars.PROD_DEPLOY_REPO }}/${{ vars.PROD_US1_DEPLOY_DIR }}/integrations
kustomize edit set image docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fyle_integrations-app=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fyle_integrations-app:$NEW_TAG
- name: Commit and push changes
run: |
NEW_TAG=${{ steps.generate-and-push-tag.outputs.new_tag }}
cd ${{ vars.PROD_DEPLOY_REPO }}/
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add .
git commit -m "Deployed fyle_integrations-app:$NEW_TAG"
git remote set-url origin https://x-access-token:${{ secrets.DEPLOY_GIT_ACCESS_TOKEN }}@github.com/${{ vars.PROD_DEPLOY_REPO }}
git pull origin master
git push origin master