Skip to content

Commit

Permalink
fix(workflow): env are truthy strings
Browse files Browse the repository at this point in the history
- Thus we store meaningful strings in env instead of booleans (which will cast to always-true strings)
  • Loading branch information
MrOrz authored Oct 3, 2023
1 parent a4fa9a4 commit 7202a24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
workflow_dispatch:

env:
PRODUCTION: ${{ startsWith(github.ref, 'refs/tags/release') }}
TARGET: ${{ startsWith(github.ref, 'refs/tags/release') && 'production' || 'staging' }}
# Docker tag prefix
RELEASE_TAG: ${{ startsWith(github.ref, 'refs/tags/release') && 'latest' || 'dev' }}

Expand Down Expand Up @@ -92,17 +92,17 @@ jobs:
hostname: ja.
devHostname: dev-ja.
environment:
# evironment.name does not have `env`, cannot use env.PRODUCTION in environment name.
# environment.name cannot use env
# Ref: https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
name: ${{ startsWith(github.ref, 'refs/tags/release') && 'production' || 'staging' }}${{ matrix.locales.postfix }}
url: https://${{ env.PRODUCTION && matrix.locales.hostname || matrix.locales.devHostname }}cofacts.tw
url: https://${{ env.TARGET == 'production' && matrix.locales.hostname || matrix.locales.devHostname }}cofacts.tw
steps:
- uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: ${{ secrets.GC_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GC_SERVICE_ACCOUNT }}
- uses: 'google-github-actions/deploy-cloudrun@v1'
with:
service: ${{ env.PRODUCTION && 'site' || 'site-staging' }}${{ matrix.locales.postfix }}
service: ${{ env.TARGET == 'production' && 'site' || 'site-staging' }}${{ matrix.locales.postfix }}
image: cofacts/rumors-site:${{ env.RELEASE_TAG }}${{ matrix.locales.postfix }}
region: ${{ matrix.locales.region }}

0 comments on commit 7202a24

Please sign in to comment.