From f5cfaac480f1a280f4398e46623bec607589f9f1 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:01:54 +0900 Subject: [PATCH 1/8] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 220be4e3..507c605c 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,12 @@ +- [Environment](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment) + ```yaml + environment: + name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} + ``` + - [Caching](https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows) - General: [actions/cache](https://github.com/actions/cache) From 2e7eb8aaef43ec6a172d8acdad761f169a3c5d2b Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:08:31 +0900 Subject: [PATCH 2/8] Create environment.yaml --- .github/workflows/environment.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/environment.yaml diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml new file mode 100644 index 00000000..7c99fe50 --- /dev/null +++ b/.github/workflows/environment.yaml @@ -0,0 +1,16 @@ +name: environment +on: + pull_request: + release: + types: + - published + push: + branches: + - main +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: check environment (${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }}) + run: | + echo ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} From 02d6591ee8f1637cbd1b3a0eb5911c5aaa6dd1ef Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:10:54 +0900 Subject: [PATCH 3/8] Update environment.yaml --- .github/workflows/environment.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml index 7c99fe50..a1bca401 100644 --- a/.github/workflows/environment.yaml +++ b/.github/workflows/environment.yaml @@ -7,10 +7,16 @@ on: push: branches: - main +env: + ENVIRONMENT: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' + jobs: run: runs-on: ubuntu-latest + environment: + name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' steps: - name: check environment (${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }}) run: | echo ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} + echo "$ENVIRONMENT" From 9f105e552598d1be50da08d03efb3b0b106efd91 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:11:44 +0900 Subject: [PATCH 4/8] Update environment.yaml --- .github/workflows/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml index a1bca401..67589106 100644 --- a/.github/workflows/environment.yaml +++ b/.github/workflows/environment.yaml @@ -8,7 +8,7 @@ on: branches: - main env: - ENVIRONMENT: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' + ENVIRONMENT: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} jobs: run: From b2e23c48ba39058ac2152d79e1add16889fd5208 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:13:19 +0900 Subject: [PATCH 5/8] commit --- .github/workflows/environment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml index 67589106..ee6b2577 100644 --- a/.github/workflows/environment.yaml +++ b/.github/workflows/environment.yaml @@ -8,13 +8,13 @@ on: branches: - main env: - ENVIRONMENT: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} + ENVIRONMENT: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} jobs: run: runs-on: ubuntu-latest environment: - name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' + name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} steps: - name: check environment (${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }}) run: | From 14d49f7f306943b91bc64ede0b849e83530d5586 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:15:15 +0900 Subject: [PATCH 6/8] Update environment.yaml --- .github/workflows/environment.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml index ee6b2577..77764b3a 100644 --- a/.github/workflows/environment.yaml +++ b/.github/workflows/environment.yaml @@ -14,9 +14,8 @@ jobs: run: runs-on: ubuntu-latest environment: - name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} + name: ${{ env.ENVIRONMENT }} steps: - - name: check environment (${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }}) + - name: check environment (${{ env.ENVIRONMENT }}) run: | - echo ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} echo "$ENVIRONMENT" From 90606e680292d671f9c3f31d2f4b326a2cac950b Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:17:13 +0900 Subject: [PATCH 7/8] Update environment.yaml --- .github/workflows/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/environment.yaml b/.github/workflows/environment.yaml index 77764b3a..eb95edda 100644 --- a/.github/workflows/environment.yaml +++ b/.github/workflows/environment.yaml @@ -14,7 +14,7 @@ jobs: run: runs-on: ubuntu-latest environment: - name: ${{ env.ENVIRONMENT }} + name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} # ${{ env.ENVIRONMENT }} ❌ steps: - name: check environment (${{ env.ENVIRONMENT }}) run: | From 1156584c5be9875369773587ff0443706a8ca020 Mon Sep 17 00:00:00 2001 From: Naka Masato Date: Mon, 16 Sep 2024 09:17:55 +0900 Subject: [PATCH 8/8] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 507c605c..779466c3 100644 --- a/README.md +++ b/README.md @@ -187,11 +187,14 @@ - [Environment](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment) + ```yaml environment: name: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'development' || github.event_name == 'pull_request' && 'pull_request' }} ``` + Example: .github/workflows/environment.yaml + - [Caching](https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows) - General: [actions/cache](https://github.com/actions/cache)