Skip to content

Commit

Permalink
fix: set environment in validate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ctot-nondef committed Jan 22, 2025
1 parent 006aa58 commit bd12357
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,10 @@ on:
- develop

jobs:
validate:
name: Validate
runs-on: ${{ matrix.os }}
timeout-minutes: 60

strategy:
fail-fast: true
matrix:
node-version: [22.x]
os: [ubuntu-latest]

env:
name: Generate environment variables
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Derive environment from git ref
id: environment
run: |
Expand All @@ -40,12 +29,37 @@ jobs:
elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then
ENVIRONMENT="development"
APP_NAME_SUFFIX="-development"
elif [ "${{github.event_name}}" = "pull_request"]; then
ENVIRONMENT="pr/${{ github.event.pull_request.number }}"
APP_NAME_SUFFIX="-pr-${{ github.event.pull_request.number }}"
else
exit 1
fi
echo "ENVIRONMENT=$ENVIRONMENT" >> $GITHUB_OUTPUT
echo "APP_NAME_SUFFIX=$APP_NAME_SUFFIX" >> $GITHUB_OUTPUT
outputs:
environment: "${{ steps.environment.outputs.ENVIRONMENT }}"
app_name: "thomas-bernhard-global${{ steps.environment.outputs.APP_NAME_SUFFIX }}"
registry: "ghcr.io"
image: "${{ github.repository }}"

validate:
name: Validate
runs-on: ${{ matrix.os }}
timeout-minutes: 60
environment:
name: "${{ needs.env.outputs.environment }}"

strategy:
fail-fast: true
matrix:
node-version: [22.x]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Necessary because `actions/setup-node` does not yet support `corepack`.
# @see https://github.com/actions/setup-node/issues/531
Expand Down

0 comments on commit bd12357

Please sign in to comment.