diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c68d5d05..99c6c9ab3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,11 @@ on: default: true required: true type: boolean + deploy: + description: 'Deploy to Staging / Prod' + default: false + required: true + type: boolean sandboxNoDbRefresh: description: 'Sandbox Disable Daily DB Refresh' default: false @@ -402,3 +407,39 @@ jobs: DEBIAN_FRONTEND: noninteractive run: | docker image prune -a -f + + # ----------------------------------------------------------------- + # STAGING + # ----------------------------------------------------------------- + staging: + name: Deploy to Staging + if: ${{ !failure() && !cancelled() && github.event.inputs.deploy == 'true' }} + needs: [prepare, release] + runs-on: ubuntu-latest + environment: + name: staging + env: + PKG_VERSION: ${{needs.prepare.outputs.pkg_version}} + + steps: + - name: Deploy to staging + run: | + curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.GH_INFRA_K8S_TOKEN }}" ${{ secrets.GHA_K8S_DEPLOY_API }} -d '{"ref":"main", "inputs": { "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"datatracker", "appVersion":"${{ env.PKG_VERSION }}" }}' + + # ----------------------------------------------------------------- + # PROD + # ----------------------------------------------------------------- + prod: + name: Deploy to Production + if: ${{ !failure() && !cancelled() && github.event.inputs.deploy == 'true' }} + needs: [staging] + runs-on: ubuntu-latest + environment: + name: production + env: + PKG_VERSION: ${{needs.prepare.outputs.pkg_version}} + + steps: + - name: Deploy to production + run: | + curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.GH_INFRA_K8S_TOKEN }}" ${{ secrets.GHA_K8S_DEPLOY_API }} -d '{"ref":"main", "inputs": { "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"datatracker", "appVersion":"${{ env.PKG_VERSION }}" }}'