Update example-reusable.yml #266
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: Example Action | |
on: | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
jobs: | |
job-with-name: | |
name: build name | |
runs-on: ubuntu-latest | |
steps: | |
- run: env | grep GITHUB_ | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
with: | |
job-name: build name | |
- run: | | |
echo github.job: ${{ github.job }} | |
job-with-environment: | |
runs-on: ubuntu-latest | |
environment: test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
job-with-matrix: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22.x, 20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
- run: | | |
echo github.job: ${{ github.job }} | |
job-with-matrix-nested-objects: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ ubuntu-16.04, ubuntu-latest ] | |
compiler: [ { cpp: g++, c: gcc }, { cpp: g++-8, c: gcc-8 } ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
- run: | | |
echo github.job: ${{ github.job }} | |
job-with-matrix-nested-arrays: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
compiler: [ [g++, gcc ], [g++-8, gcc-8 ] ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./ | |
- run: | | |
echo github.job: ${{ github.job }} | |
job-with-reusable-workflow-with-matrix: | |
strategy: | |
matrix: | |
node-version: [ 22.x, 20.x ] | |
uses: ./.github/workflows/example-reusable.yml | |
with: | |
# IMPORTANT ensure first value match the surrounding job name | |
# IMPORTANT If the surrounding workflow is a reusable workflow itself, append ', ${{ inputs.workflow-context }}' | |
workflow-context: job-with-reusable-workflow-with-matrix, ${{ toJSON(matrix) }} | |
job-with-reusable-workflow-nested: | |
uses: ./.github/workflows/example-reusable-nested.yml | |
with: | |
# IMPORTANT ensure first value match the surrounding job name | |
# IMPORTANT If the surrounding workflow is a reusable workflow itself, append ', ${{ inputs.workflow-context }}' | |
workflow-context: job-with-reusable-workflow-nested, ${{ toJSON(matrix) }} | |
job-with-real-long-id-abcdefghijklmnopyrstuvwxyz-abcdefghijklmnopyrstuvwxyz-abcdefghijklmnopyrstuv: | |
strategy: | |
matrix: | |
node-version: [ 22.x, 20.x ] | |
uses: ./.github/workflows/example-reusable.yml | |
with: | |
# IMPORTANT ensure first value match the surrounding job name | |
# IMPORTANT If the surrounding workflow is a reusable workflow itself, append ', ${{ inputs.workflow-context }}' | |
workflow-context: job-with-real-long-id-abcdefghijklmnopyrstuvwxyz-abcdefghijklmnopyrstuvwxyz-abcdefghijklmnopyrstuv, ${{ toJSON(matrix) }} |