Skip to content

Commit

Permalink
fix: 'env' context is not available in the places we need it
Browse files Browse the repository at this point in the history
put the expression back as inline values instead of being a variable
  • Loading branch information
angela-tran committed Oct 2, 2023
1 parent b910707 commit e1b4e08
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ defaults:
run:
shell: bash

env:
# this expression works like a ternary operation (see https://github.com/actions/runner/issues/409#issuecomment-727565588)
- DEPLOYMENT_ENVIRONMENT: ${{ github.event_name != 'release' && github.ref_name || github.event.release.prerelease && 'test' || 'prod' }}

concurrency:
group: ${{ env.DEPLOYMENT_ENVIRONMENT }}
# this expression gives us the name of the deployment environment. It works like a ternary operation (see https://github.com/actions/runner/issues/409#issuecomment-727565588)
group: ${{ github.event_name != 'release' && github.ref_name || github.event.release.prerelease && 'test' || 'prod' }}
cancel-in-progress: true

jobs:
Expand All @@ -34,7 +31,7 @@ jobs:
# (github.event_name != 'release' || needs.test.result == 'success') is needed because if `test` did run, we only want this to run if `test` succeeded.
if: (!cancelled() && (github.event_name != 'release' || needs.test.result == 'success'))
runs-on: ubuntu-latest
environment: ${{ env.DEPLOYMENT_ENVIRONMENT }}
environment: ${{ github.event_name != 'release' && github.ref_name || github.event.release.prerelease && 'test' || 'prod' }}

steps:
- name: Checkout
Expand Down Expand Up @@ -83,6 +80,6 @@ jobs:
file: Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ env.DEPLOYMENT_ENVIRONMENT }}
ghcr.io/${{ github.repository }}:${{ github.event_name != 'release' && github.ref_name || github.event.release.prerelease && 'test' || 'prod' }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:${{ github.sha }}

0 comments on commit e1b4e08

Please sign in to comment.