From 10df31131165f75375940ea1afcf594be2f822cd Mon Sep 17 00:00:00 2001 From: ruuushhh <66899387+ruuushhh@users.noreply.github.com> Date: Thu, 23 May 2024 13:46:38 +0530 Subject: [PATCH] Add QA deployment (#612) * Add QA deployment * Fix path --- .github/workflows/qa_deployment.yml | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/qa_deployment.yml diff --git a/.github/workflows/qa_deployment.yml b/.github/workflows/qa_deployment.yml new file mode 100644 index 00000000..1018af4a --- /dev/null +++ b/.github/workflows/qa_deployment.yml @@ -0,0 +1,53 @@ +name: Deploy to QA + +on: + push: + branches: + - master + pull_request: + types: [labeled] + +jobs: + staging_deploy: + if: (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'qa_deploy') + runs-on: ubuntu-latest + environment: QA + steps: + - uses: actions/checkout@v2 + - name: push to dockerhub + uses: fylein/docker-release-action@master + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + IMAGE_NAME: fyle_qbo-api + + - 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.STAGING_DEPLOY_REPO }} + ref: master + path: ${{ vars.STAGING_DEPLOY_REPO }} + persist-credentials: false + token: ${{ secrets.DEPLOY_GIT_ACCESS_TOKEN }} + + - name: Update Image Tag + run: | + NEW_TAG="v$(git rev-parse --short HEAD)" + cd ${{ vars.STAGING_DEPLOY_REPO }}/${{ vars.C1_STAGING_DEPLOY_DIR }}/qa/integrations + kustomize edit set image docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fyle_qbo-api=docker.io/${{ secrets.DOCKERHUB_USERNAME }}/fyle_qbo-api:$NEW_TAG + + - name: Commit and push changes + run: | + cd ${{ vars.STAGING_DEPLOY_REPO }}/ + git config --global user.email "integrations@fylehq.com" + git config --global user.name "GitHub Actions" + git add . + git commit -m "Deployed fyle_qbo-api-qa:$NEW_TAG to staging" + git remote set-url origin https://x-access-token:${{ secrets.DEPLOY_GIT_ACCESS_TOKEN }}@github.com/${{ vars.STAGING_DEPLOY_REPO }} + git pull origin master + git push origin master