Promote to Production #53
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
| # Production promotion: | |
| # | |
| # Deliver succeeds -> [approval] -> promote GHCR image to :stable | |
| # | |
| # Split out of deliver.yml so a pending/never-granted approval can no | |
| # longer turn the build/test/package/staging pipeline red. This workflow | |
| # is triggered automatically once Deliver succeeds on master, then waits | |
| # on the `production` environment's manual approval like before. | |
| name: Promote to Production | |
| on: | |
| workflow_run: | |
| workflows: ["Deliver"] | |
| types: [completed] | |
| workflow_dispatch: | |
| inputs: | |
| sha: | |
| description: 'Commit SHA to promote (defaults to the latest successful Deliver run on master)' | |
| required: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| promote: | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'master') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Resolve commit and image | |
| run: | | |
| echo "SHA=${{ github.event.inputs.sha || github.event.workflow_run.head_sha }}" >> "$GITHUB_ENV" | |
| echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/joltrin-quickstart" >> "$GITHUB_ENV" | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Promote image to stable | |
| run: | | |
| docker pull $IMAGE:$SHA | |
| docker tag $IMAGE:$SHA $IMAGE:stable | |
| docker push $IMAGE:stable | |
| # GitHub Pages deployment is handled solely by deploy-demo.yml, which | |
| # builds and publishes both the WASM demo and SOP Arena together as one | |
| # artifact. This job used to also run a separate Jekyll build of the | |
| # whole repo and deploy that to the same "github-pages" environment on | |
| # every push, which silently overwrote the demo/Arena deployment each | |
| # time this workflow ran after it. Removed rather than coordinated, | |
| # since a plain Jekyll build of the repo root was not serving any | |
| # distinct purpose from the dedicated demo/Arena site. |