Deploy to Production #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Deploy to Production Workflow | |
| name: Deploy to Production | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: read | |
| env: | |
| ECCR_GEOGLOWS_TOKEN: ${{ secrets.ECCR_GEOGLOWS_TOKEN }} | |
| jobs: | |
| verify-prerequisites: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| can-deploy: ${{ steps.check.outputs.can_deploy }} | |
| steps: | |
| - name: Check build and staging status | |
| id: check | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const tag = '${{ github.ref_name }}'; | |
| const workflows = ['Build', 'Deploy to Staging']; | |
| const results = await Promise.all(workflows.map(async (workflow) => { | |
| const runs = await github.rest.actions.listWorkflowRuns({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: workflow, | |
| per_page: 5 | |
| }); | |
| return runs.data.workflow_runs.some(run => | |
| run.head_branch === tag && run.conclusion === 'success' | |
| ); | |
| })); | |
| core.setOutput('can_deploy', results.every(result => result) ? 'true' : 'false'); | |
| deploy: | |
| needs: verify-prerequisites | |
| if: needs.verify-prerequisites.outputs.can_deploy == 'true' | |
| name: Deploy to Production | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to Production | |
| run: | | |
| echo ${{ github.ref_name }} | |
| curl -X POST -H "Authorization: Bearer $ECCR_GEOGLOWS_TOKEN" -d "bamboo.COMMIT_TAG=${{ github.ref_name }}" https://bamboo.ecmwf.int/rest/api/latest/queue/GEOGLOWS-GSPRES1 |