From 979c20790eeb7a0c911bfca3cf2ef391ef2337a2 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:49:19 +0900 Subject: [PATCH] =?UTF-8?q?CI=20release:=20push=E3=83=88=E3=83=AA=E3=82=AC?= =?UTF-8?q?=E3=83=BC=E3=81=A7=E5=AE=9F=E8=A1=8C=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?job=E3=82=92=E6=B8=9B=E3=82=89=E3=81=99=20(#3894)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 147e86f3c..8655517b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,7 +138,7 @@ jobs: format-go: runs-on: ubuntu-latest needs: docker-compose-build-base - if: always() && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') + if: always() && github.event_name != 'push' && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') permissions: contents: write pull-requests: write @@ -178,7 +178,7 @@ jobs: update-package: runs-on: ubuntu-latest needs: docker-compose-build-base - if: always() && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') + if: always() && github.event_name != 'push' && (needs.docker-compose-build-base.result == 'success' || (github.event_name == 'pull_request' && github.event.action == 'closed') || github.event_name == 'merge_group') permissions: contents: write pull-requests: write @@ -250,6 +250,7 @@ jobs: pr-title-prefix: nodeのバージョンを直してあげたよ! update-dockle: runs-on: ubuntu-latest + if: github.event_name != 'push' steps: - uses: actions/checkout@v4.1.1 if: github.event_name != 'pull_request' || github.event.action != 'closed' @@ -263,6 +264,7 @@ jobs: runs-on: ubuntu-latest needs: - docker-compose-build + if: github.event_name != 'push' steps: - uses: actions/checkout@v4.1.1 - run: cat .env >>"$GITHUB_ENV" @@ -276,6 +278,7 @@ jobs: needs: - docker-compose-build - update-dockle + if: github.event_name != 'push' strategy: matrix: docker_compose_file_name: ["dev.base.compose.yml", "staging.compose.yml"] @@ -327,6 +330,7 @@ jobs: env: DOCKER_CONTENT_TRUST: 1 REPOSITORY: ${{github.repository}} + if: github.event_name != 'push' steps: - uses: actions/checkout@v4.1.1 - run: cat .env >>"$GITHUB_ENV" @@ -361,6 +365,7 @@ jobs: env: DOCKER_CONTENT_TRUST: 1 REPOSITORY: ${{github.repository}} + if: github.event_name != 'push' steps: - uses: actions/checkout@v4.1.1 - run: cat .env >>"$GITHUB_ENV" @@ -388,6 +393,8 @@ jobs: needs: - build-frontend - e2e-test-mini-docker-compose + - docker-compose-build + - make-browserslist if: github.event_name == 'push' || github.event_name == 'merge_group' || (github.repository == github.event.pull_request.head.repo.full_name && github.repository == 'dev-hato/hato-atama') permissions: id-token: write @@ -445,6 +452,7 @@ jobs: env: ARTIFACT_PATH: ${{ github.workspace }}/tmp/artifacts URLS: https://v${{ github.run_number }}-dot-hato-atama.an.r.appspot.com + if: github.event_name != 'push' steps: - uses: actions/checkout@v4.1.1 - run: mkdir -p "${ARTIFACT_PATH}" @@ -488,7 +496,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 3 needs: - - e2e-test-all-docker-compose - e2e-test-mini-prd - make-browserslist strategy: @@ -564,31 +571,17 @@ jobs: - name: Remove app engine versions if: ${{ steps.get_run_numbers.outputs.result != '' }} run: gcloud app versions delete --service=default ${{steps.get_run_numbers.outputs.result}} - # docker-compose関連でPRとpushで共通して必ず完了しているべきjobが完了したか - release-complete-check-docker-compose: - runs-on: ubuntu-latest - needs: - - update-package - - format-go - - check-nginx-config - - dockle - - e2e-test-mini-docker-compose - - e2e-test-all-docker-compose - steps: - - run: exit 0 # PRとpushで共通して完了しているべきjobが完了したか release-complete-check: runs-on: ubuntu-latest if: always() && (github.event_name != 'pull_request' || github.event.action != 'closed') needs: - - lighthouse - e2e-test-mini-prd - check-deploy-diff - - release-complete-check-docker-compose steps: - - if: (github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || (needs.lighthouse.result == 'success' && needs.e2e-test-mini-prd.result == 'success')) && needs.release-complete-check-docker-compose.result == 'success' + - if: (github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || needs.e2e-test-mini-prd.result == 'success') run: exit 0 - - if: (github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && (needs.lighthouse.result != 'success' || needs.e2e-test-mini-prd.result != 'success')) || needs.release-complete-check-docker-compose.result != 'success' + - if: (github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && needs.e2e-test-mini-prd.result != 'success') run: exit 1 # PRをトリガーとした場合に完了しているべきjobが完了したか # forkしたリポジトリからdev-hato/hato-atamaへPRを出した場合やforkしたリポジトリ上でPRを立てた場合、merge_groupトリガーの場合はcreate-pr-environmentがskipされていても完了したものと見なす @@ -596,13 +589,20 @@ jobs: runs-on: ubuntu-latest if: always() && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'merge_group') needs: + - lighthouse + - format-go + - update-package + - dockle + - check-nginx-config + - e2e-test-mini-docker-compose + - e2e-test-all-docker-compose - release-complete-check - create-pr-environment - check-deploy-diff steps: - - if: needs.release-complete-check.result == 'success' && (github.event_name == 'merge_group' || github.repository != github.event.pull_request.head.repo.full_name || github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || needs.create-pr-environment.result == 'success') + - if: needs.release-complete-check.result == 'success' && (github.event_name == 'merge_group' || github.repository != github.event.pull_request.head.repo.full_name || github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || (needs.create-pr-environment.result == 'success' && needs.lighthouse.result == 'success' && needs.format-go.result == 'success' && needs.update-package.result == 'success' && needs.dockle.result == 'success' && needs.check-nginx-config.result == 'success' && needs.e2e-test-mini-docker-compose.result == 'success' && needs.e2e-test-all-docker-compose.result == 'success')) run: exit 0 - - if: needs.release-complete-check.result != 'success' || (github.event_name != 'merge_group' && github.repository == github.event.pull_request.head.repo.full_name && github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && needs.create-pr-environment.result != 'success') + - if: needs.release-complete-check.result != 'success' || (github.event_name != 'merge_group' && github.repository == github.event.pull_request.head.repo.full_name && github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && (needs.create-pr-environment.result != 'success' || needs.lighthouse.result != 'success' || needs.format-go.result != 'success' || needs.update-package.result != 'success' || needs.dockle.result != 'success' || needs.check-nginx-config.result != 'success' || needs.e2e-test-mini-docker-compose.result != 'success' || needs.e2e-test-all-docker-compose.result != 'success')) run: exit 1 action-timeline-pr-test-complete: needs: pr-test-complete