From ccf80a51e818b1d66331d5475b610ef5774a9226 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 20:45:23 +0900 Subject: [PATCH 01/11] Create matrix-from-previous-job-output-2.yaml --- .../matrix-from-previous-job-output-2.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/matrix-from-previous-job-output-2.yaml diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml new file mode 100644 index 00000000..cfcbb0ed --- /dev/null +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -0,0 +1,44 @@ +name: matrix-from-previous-job-output-2 +on: + pull_request: + +jobs: + setup: + # runs-on: ubuntu-latest + # outputs: + # matrix: ${{ steps.outputs.matrix }} + # steps: + # - uses: actions/checkout@v3 + # with: + # fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + # - name: get all changes + # id: changed-files-yaml + # uses: tj-actions/changed-files@v38 + # with: + # files_yaml: | + # dev: + # - 'static/dev/**' + # prod: + # - 'static/prod/**' + + # - name: make matrix + # id: matrix + # run: | + # echo "matrix=[{\"env\": \"dev\", \"changed\": \"${{ steps.changed-files-yaml.outputs.test_any_changed }}\" }, {}]' >> $GITHUB_OUTPUT + + execute: + strategy: + matrix: + # matrix: ${{ fromJson(needs.setup.outputs.matrix) }} + env: ["dev", "prod"] + include: + - env: "dev" + changed: true + - env: "prod" + changed: false + runs-on: ubuntu-latest + needs: [setup] + steps: + - run: | + echo "env: ${{ matrix.env }}, changed: ${{ matrix.changed }}" From 87fa64ddc5d51c6e57b951a646260f54cf707000 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 20:46:41 +0900 Subject: [PATCH 02/11] Update matrix-from-previous-job-output-2.yaml --- .../matrix-from-previous-job-output-2.yaml | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml index cfcbb0ed..34806f5d 100644 --- a/.github/workflows/matrix-from-previous-job-output-2.yaml +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -3,29 +3,29 @@ on: pull_request: jobs: - setup: - # runs-on: ubuntu-latest - # outputs: - # matrix: ${{ steps.outputs.matrix }} - # steps: - # - uses: actions/checkout@v3 - # with: - # fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + # setup: + # runs-on: ubuntu-latest + # outputs: + # matrix: ${{ steps.outputs.matrix }} + # steps: + # - uses: actions/checkout@v3 + # with: + # fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - # - name: get all changes - # id: changed-files-yaml - # uses: tj-actions/changed-files@v38 - # with: - # files_yaml: | - # dev: - # - 'static/dev/**' - # prod: - # - 'static/prod/**' + # - name: get all changes + # id: changed-files-yaml + # uses: tj-actions/changed-files@v38 + # with: + # files_yaml: | + # dev: + # - 'static/dev/**' + # prod: + # - 'static/prod/**' - # - name: make matrix - # id: matrix - # run: | - # echo "matrix=[{\"env\": \"dev\", \"changed\": \"${{ steps.changed-files-yaml.outputs.test_any_changed }}\" }, {}]' >> $GITHUB_OUTPUT + # - name: make matrix + # id: matrix + # run: | + # echo "matrix=[{\"env\": \"dev\", \"changed\": \"${{ steps.changed-files-yaml.outputs.test_any_changed }}\" }, {}]' >> $GITHUB_OUTPUT execute: strategy: @@ -38,7 +38,7 @@ jobs: - env: "prod" changed: false runs-on: ubuntu-latest - needs: [setup] + # needs: [setup] steps: - run: | echo "env: ${{ matrix.env }}, changed: ${{ matrix.changed }}" From 71e512ab79076155572ef90d89576bcf9ad6855a Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 20:55:47 +0900 Subject: [PATCH 03/11] Update matrix-from-previous-job-output-2.yaml --- .../matrix-from-previous-job-output-2.yaml | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml index 34806f5d..f20a1d11 100644 --- a/.github/workflows/matrix-from-previous-job-output-2.yaml +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -3,42 +3,40 @@ on: pull_request: jobs: - # setup: - # runs-on: ubuntu-latest - # outputs: - # matrix: ${{ steps.outputs.matrix }} - # steps: - # - uses: actions/checkout@v3 - # with: - # fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - - # - name: get all changes - # id: changed-files-yaml - # uses: tj-actions/changed-files@v38 - # with: - # files_yaml: | - # dev: - # - 'static/dev/**' - # prod: - # - 'static/prod/**' + setup: + outputs: + DEV_CHANGED: ${{ steps.changed-files-yaml.outputs.dev_any_changed }} + PROD_CHANGED: ${{ steps.changed-files-yaml.outputs.prod_any_changed }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - # - name: make matrix - # id: matrix - # run: | - # echo "matrix=[{\"env\": \"dev\", \"changed\": \"${{ steps.changed-files-yaml.outputs.test_any_changed }}\" }, {}]' >> $GITHUB_OUTPUT + - name: get all changes for static/dev and static/prod + id: changed-files-yaml + uses: tj-actions/changed-files@v38 + with: + files_yaml: | + dev: + - 'static/dev/**' + prod: + - 'static/prod/**' + - run: | + echo "dev: ${{ steps.changed-files-yaml.outputs.dev_any_changed }}" >> $GITHUB_STEP_SUMMARY + echo "prod: ${{ steps.changed-files-yaml.outputs.prod_any_changed }}" >> $GITHUB_STEP_SUMMARY execute: strategy: matrix: - # matrix: ${{ fromJson(needs.setup.outputs.matrix) }} env: ["dev", "prod"] include: - env: "dev" - changed: true + changed: ${{ needs.check-changed-files.outputs.DEV_CHANGED }} - env: "prod" - changed: false + changed: ${{ needs.check-changed-files.outputs.PROD_CHANGED }} runs-on: ubuntu-latest - # needs: [setup] + needs: [setup] steps: - run: | echo "env: ${{ matrix.env }}, changed: ${{ matrix.changed }}" From 054513a68b34ba556be3f386461762029af7b182 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 20:58:54 +0900 Subject: [PATCH 04/11] Update matrix-from-previous-job-output-2.yaml --- .github/workflows/matrix-from-previous-job-output-2.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml index f20a1d11..e33d0c58 100644 --- a/.github/workflows/matrix-from-previous-job-output-2.yaml +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -27,6 +27,7 @@ jobs: echo "prod: ${{ steps.changed-files-yaml.outputs.prod_any_changed }}" >> $GITHUB_STEP_SUMMARY execute: + if: ${{ matrix.changed == 'true' }} strategy: matrix: env: ["dev", "prod"] From 54947416cf59b91288b66f23e95c96e05dd3d049 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:16:32 +0900 Subject: [PATCH 05/11] Update matrix-from-previous-job-output-2.yaml --- .../matrix-from-previous-job-output-2.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml index e33d0c58..c2811ff4 100644 --- a/.github/workflows/matrix-from-previous-job-output-2.yaml +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -7,6 +7,7 @@ jobs: outputs: DEV_CHANGED: ${{ steps.changed-files-yaml.outputs.dev_any_changed }} PROD_CHANGED: ${{ steps.changed-files-yaml.outputs.prod_any_changed }} + CHANGED_ENVS: ${{ steps.matrix.outputs.CHANGED_ENVS }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -22,22 +23,18 @@ jobs: - 'static/dev/**' prod: - 'static/prod/**' - - run: | + - id: matrix + run: | echo "dev: ${{ steps.changed-files-yaml.outputs.dev_any_changed }}" >> $GITHUB_STEP_SUMMARY echo "prod: ${{ steps.changed-files-yaml.outputs.prod_any_changed }}" >> $GITHUB_STEP_SUMMARY + echo "CHANGED_ENVS=$(echo "[{\"env\": \"dev\", \"changed\": ${{ steps.changed-files-yaml.outputs.dev_any_changed }}}, {\"env\":\"prod\", \"changed\": ${{ steps.changed-files-yaml.outputs.prod_any_changed }} }]" | jq -c 'map(select( .changed ).env)')" >> $GITHUB_OUTPUT execute: - if: ${{ matrix.changed == 'true' }} strategy: matrix: - env: ["dev", "prod"] - include: - - env: "dev" - changed: ${{ needs.check-changed-files.outputs.DEV_CHANGED }} - - env: "prod" - changed: ${{ needs.check-changed-files.outputs.PROD_CHANGED }} + env: ${{ fromJson(needs.setup.outputs.CHANGED_ENVS) }} runs-on: ubuntu-latest needs: [setup] steps: - run: | - echo "env: ${{ matrix.env }}, changed: ${{ matrix.changed }}" + echo "env: ${{ matrix.env }}" From 2809069143b4d9881738aa6730cd883a0bc0c2af Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:18:06 +0900 Subject: [PATCH 06/11] Update matrix-from-previous-job-output-2.yaml --- .github/workflows/matrix-from-previous-job-output-2.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml index c2811ff4..3a75495e 100644 --- a/.github/workflows/matrix-from-previous-job-output-2.yaml +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -30,11 +30,12 @@ jobs: echo "CHANGED_ENVS=$(echo "[{\"env\": \"dev\", \"changed\": ${{ steps.changed-files-yaml.outputs.dev_any_changed }}}, {\"env\":\"prod\", \"changed\": ${{ steps.changed-files-yaml.outputs.prod_any_changed }} }]" | jq -c 'map(select( .changed ).env)')" >> $GITHUB_OUTPUT execute: - strategy: - matrix: - env: ${{ fromJson(needs.setup.outputs.CHANGED_ENVS) }} + # strategy: + # matrix: + # env: ${{ fromJson(needs.setup.outputs.CHANGED_ENVS) }} runs-on: ubuntu-latest needs: [setup] steps: - run: | - echo "env: ${{ matrix.env }}" + # echo "env: ${{ matrix.env }}" + echo ${{ needs.setup.outputs.CHANGED_ENVS }} From de6216fc5c765b92c37b1ad82162e2d22e681df0 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:19:06 +0900 Subject: [PATCH 07/11] Create test.txt --- static/dev/test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 static/dev/test.txt diff --git a/static/dev/test.txt b/static/dev/test.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/static/dev/test.txt @@ -0,0 +1 @@ + From 9fed2cf6a51f125c82e5ff307975b7e693179762 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:22:06 +0900 Subject: [PATCH 08/11] Update matrix-from-previous-job-output-2.yaml --- .github/workflows/matrix-from-previous-job-output-2.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yaml index 3a75495e..7aa6bb6b 100644 --- a/.github/workflows/matrix-from-previous-job-output-2.yaml +++ b/.github/workflows/matrix-from-previous-job-output-2.yaml @@ -30,12 +30,11 @@ jobs: echo "CHANGED_ENVS=$(echo "[{\"env\": \"dev\", \"changed\": ${{ steps.changed-files-yaml.outputs.dev_any_changed }}}, {\"env\":\"prod\", \"changed\": ${{ steps.changed-files-yaml.outputs.prod_any_changed }} }]" | jq -c 'map(select( .changed ).env)')" >> $GITHUB_OUTPUT execute: - # strategy: - # matrix: - # env: ${{ fromJson(needs.setup.outputs.CHANGED_ENVS) }} + strategy: + matrix: + env: ${{ fromJson(needs.setup.outputs.CHANGED_ENVS) }} runs-on: ubuntu-latest needs: [setup] steps: - run: | - # echo "env: ${{ matrix.env }}" - echo ${{ needs.setup.outputs.CHANGED_ENVS }} + echo "matrix: ${{ matrix.env }}" From 5b02925583aec42ca949b32d9ada984239d762d1 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:23:01 +0900 Subject: [PATCH 09/11] Rename matrix-from-previous-job-output-2.yaml to matrix-from-previous-job-output-2.yml --- ...us-job-output-2.yaml => matrix-from-previous-job-output-2.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{matrix-from-previous-job-output-2.yaml => matrix-from-previous-job-output-2.yml} (100%) diff --git a/.github/workflows/matrix-from-previous-job-output-2.yaml b/.github/workflows/matrix-from-previous-job-output-2.yml similarity index 100% rename from .github/workflows/matrix-from-previous-job-output-2.yaml rename to .github/workflows/matrix-from-previous-job-output-2.yml From 370fd2e1b3eda21eb6a602f08579e132574bb86c Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:23:12 +0900 Subject: [PATCH 10/11] Update test.txt From 05ae276a2a58c69b56679c1f70e5742357e5817f Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Tue, 29 Aug 2023 21:25:00 +0900 Subject: [PATCH 11/11] Update test.txt --- static/dev/test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/dev/test.txt b/static/dev/test.txt index 8b137891..9daeafb9 100644 --- a/static/dev/test.txt +++ b/static/dev/test.txt @@ -1 +1 @@ - +test