One-Click Deploy #4
This file contains 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
name: One-Click Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: The image currently running in production will be deployed to the selected environment. Branch picker determines which Nomad job definition is used. | |
required: true | |
type: environment | |
jobs: | |
find-image-digest: | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
outputs: | |
image_digest: ${{ steps.get-image-digest.outputs.image_digest }} | |
steps: | |
- name: Setup Nomad | |
uses: lucasmelin/[email protected] | |
- name: Exchange GitHub JWT for Nomad token | |
uses: RoboJackets/nomad-jwt-auth@main | |
with: | |
url: https://nomad.bcdc.robojackets.net | |
jwtGithubAudience: https://nomad.bcdc.robojackets.net | |
methodName: GitHubActions | |
- name: Get production image digest | |
id: get-image-digest | |
env: | |
NOMAD_ADDR: https://nomad.bcdc.robojackets.net | |
run: >- | |
echo "image_digest=$(nomad job inspect apiary-production | jq --raw-output .Job.TaskGroups[0].Tasks[0].Config.image | cut -d "@" -f 2)" >> $GITHUB_OUTPUT | |
deploy: | |
name: Deploy | |
needs: [find-image-digest] | |
uses: ./.github/workflows/deploy.yml | |
concurrency: | |
group: deploy-${{ inputs.environment }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
with: | |
image-digest: ${{ needs.find-image-digest.outputs.image_digest }} | |
environment: ${{ inputs.environment }} | |
precompressed-assets: true |