-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create matrix-from-previous-job-output-3.yml (#1346)
* Create matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update matrix-from-previous-job-output-3.yml * Update README.md
- Loading branch information
1 parent
597f071
commit 4f34eb8
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: matrix-from-previous-job-output-3 | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
# From https://github.com/dorny/paths-filter | ||
# JOB to run change detection | ||
set-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
include: ${{ steps.set-matrix.outputs.include }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# Deploy each app to dev for pull request | ||
# Deploy each app to both prod and dev for push (main) | ||
- name: set matrix | ||
id: set-matrix | ||
run: | | ||
if [[ "${{ github.event_name }}" = "pull_request" ]]; then | ||
echo "include=[{\"app\": \"app1\", \"env\": \"dev\"}, {\"app\": \"app2\", \"env\": \"dev\"}]" >> "$GITHUB_OUTPUT" | ||
elif [[ "${{ github.event_name }}" = "push" ]]; then | ||
echo "include=[{\"app\": \"app1\", \"env\": \"dev\"}, {\"app\": \"app1\", \"env\": \"prod\"}, {\"app\": \"app2\", \"env\": \"dev\"}, {\"app\": \"app2\", \"env\": \"prod\"}]" >> "$GITHUB_OUTPUT" | ||
fi | ||
execute: | ||
strategy: | ||
matrix: | ||
include: ${{ fromJson(needs.set-matrix.outputs.include) }} | ||
runs-on: ubuntu-latest | ||
needs: [set-matrix] | ||
steps: | ||
- name: "app: ${{ matrix.app }}, matrix: ${{ matrix.env }}" | ||
run: | | ||
echo "app: ${{ matrix.app }}, matrix: ${{ matrix.env }}" |
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