release #12279
Workflow file for this run
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: release | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- closed | |
merge_group: | |
env: | |
GCP_WORKLOAD_IDENTITY_PROVIDER: 'projects/765091727073/locations/global/workloadIdentityPools/hato-atama-workload-identity/providers/github' | |
GCP_SERVICE_ACCOUNT: '[email protected]' | |
jobs: | |
# App Engineにデプロイされるファイルの差分の有無を判定する | |
check-deploy-diff: | |
runs-on: ubuntu-latest | |
outputs: | |
deploy-files: ${{ steps.changes.outputs.deploy-files }} | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
steps: | |
- uses: actions/[email protected] | |
- uses: dorny/[email protected] | |
id: changes | |
with: | |
filters: | | |
deploy-files: | |
- '.github/workflows/release.yml' | |
- 'frontend/**' | |
- 'server/**' | |
- 'scripts/release/**' | |
- 'test/**' | |
- 'app.yaml' | |
- 'go.mod' | |
- 'go.sum' | |
- '.gcloudignore' | |
build-frontend: | |
runs-on: ubuntu-latest | |
needs: check-deploy-diff | |
if: needs.check-deploy-diff.outputs.deploy-files == 'true' | |
defaults: | |
run: | |
working-directory: frontend | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version-file: frontend/.node-version | |
cache: npm | |
cache-dependency-path: frontend/package-lock.json | |
- name: Build | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/build_frontend/build.sh" | |
- uses: actions/[email protected] | |
with: | |
name: frontend | |
path: frontend/dist | |
docker-compose-build-base: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: 1 | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
REPOSITORY: ${{github.repository}} | |
permissions: | |
contents: read | |
packages: write | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed' && github.repository == github.event.pull_request.head.repo.full_name) || github.event_name == 'merge_group' | |
steps: | |
- uses: actions/[email protected] | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
- run: cat .env >>"$GITHUB_ENV" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
- name: Build and push | |
uses: docker/[email protected] | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
with: | |
push: true | |
targets: server,frontend | |
files: compose.yml,base.compose.yml | |
docker-compose-build: | |
runs-on: ubuntu-latest | |
needs: docker-compose-build-base | |
env: | |
DOCKER_BUILDKIT: 1 | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
REPOSITORY: ${{github.repository}} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/[email protected] | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
- run: cat .env >>"$GITHUB_ENV" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
- name: Build and push (dev) | |
uses: docker/[email protected] | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
with: | |
push: true | |
files: compose.yml,dev.base.compose.yml | |
- name: Build and push (staging) | |
uses: docker/[email protected] | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
with: | |
push: true | |
files: compose.yml,staging.compose.yml | |
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') | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
REPOSITORY: ${{github.repository}} | |
steps: | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | |
- if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/change_file_and_env.sh" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' && github.event.action != 'closed' | |
- name: Get Go version | |
id: get_go_version | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: bash "${GITHUB_WORKSPACE}/scripts/get_go_version.sh" | |
- name: Set up Go | |
uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
go-version: ${{steps.get_go_version.outputs.go_version}} | |
- name: Install goimports | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/format_go/run_goimports.sh" | |
- uses: dev-hato/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
branch-name-prefix: fix-format | |
pr-title-prefix: formatが間違ってたので直してあげたよ! | |
# .node-version や package.json のNode.js・npmのバージョンをDockerイメージと同期させ、npm installを実行した結果、差分があればPRを作る | |
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') | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
DOCKER_CMD: "node --version && npm --version" | |
steps: | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | |
- if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/change_file_and_env.sh" | |
- name: Get Dependabot Node.js version | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
id: get_dependabot_node_version | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/update_package/get_dependabot_node_version.sh" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.action != 'closed') | |
- name: Get Node.js version | |
id: get_node_version | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
REPOSITORY: ${{github.repository}} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/update_package/get_node_version.sh" | |
- name: Update versions | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
env: | |
DEPENDABOT_NODE_VERSION: ${{steps.get_dependabot_node_version.outputs.node_version}} | |
DEPENDABOT_NPM_VERSION: ${{steps.get_dependabot_node_version.outputs.npm_version}} | |
NODE_VERSION: ${{steps.get_node_version.outputs.node_version}} | |
NPM_VERSION: ${{steps.get_node_version.outputs.npm_version}} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/update_package/update_versions.sh" | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- name: Update packages (.) | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: npm install | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
node-version-file: frontend/.node-version | |
cache: npm | |
cache-dependency-path: frontend/package-lock.json | |
- name: Update packages (frontend) | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: npm install | |
working-directory: frontend | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
node-version-file: test/e2e/.node-version | |
cache: npm | |
cache-dependency-path: test/e2e/package-lock.json | |
- name: Update packages (test/e2e) | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: npm install | |
working-directory: test/e2e | |
- uses: dev-hato/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
branch-name-prefix: fix-version | |
pr-title-prefix: nodeのバージョンを直してあげたよ! | |
update-dockle: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | |
- uses: dev-hato/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
check-nginx-config: | |
runs-on: ubuntu-latest | |
needs: | |
- docker-compose-build | |
steps: | |
- uses: actions/[email protected] | |
- run: cat .env >>"$GITHUB_ENV" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/check_nginx_config/check_nginx_config.sh" | |
dockle: | |
runs-on: ubuntu-latest | |
needs: | |
- docker-compose-build | |
- update-dockle | |
strategy: | |
matrix: | |
docker_compose_file_name: ["dev.base.compose.yml", "staging.compose.yml"] | |
include: | |
- docker_compose_file_name: "base.compose.yml" | |
service_name: "server" | |
- docker_compose_file_name: "base.compose.yml" | |
service_name: "frontend" | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
REPOSITORY: ${{github.repository}} | |
steps: | |
- uses: actions/[email protected] | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
- env: | |
DOCKER_COMPOSE_FILE_NAME: ${{matrix.docker_compose_file_name}} | |
SERVICE_NAME: ${{matrix.service_name}} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/dockle/run_dockle.sh" | |
make-browserslist: | |
runs-on: ubuntu-latest | |
needs: update-package | |
outputs: | |
browserslist: ${{ steps.set_browserslist.outputs.browserslist }} | |
defaults: | |
run: | |
working-directory: frontend | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version-file: frontend/.node-version | |
cache: npm | |
cache-dependency-path: frontend/package-lock.json | |
- name: Set Browserslist | |
id: set_browserslist | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/make_browserslist/set_browserslist.sh" | |
e2e-test-mini-docker-compose: | |
runs-on: ubuntu-latest | |
needs: | |
- docker-compose-build | |
- make-browserslist | |
strategy: | |
matrix: | |
browser_name: ["chrome", "electron", "edge"] | |
include: ${{fromJson(needs.make-browserslist.outputs.browserslist)}} | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
REPOSITORY: ${{github.repository}} | |
steps: | |
- uses: actions/[email protected] | |
- run: cat .env >>"$GITHUB_ENV" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/run_docker_compose.sh" | |
- uses: actions/[email protected] | |
with: | |
node-version-file: test/e2e/.node-version | |
cache: npm | |
cache-dependency-path: test/e2e/package-lock.json | |
- uses: browser-actions/[email protected] | |
if: matrix.browser_name == 'firefox' | |
with: | |
firefox-version: ${{ matrix.browser_version }} | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/set_docker_compose_test_env.sh" | |
- env: | |
BROWSER_NAME: ${{ matrix.browser_name }} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/run_mini_test.sh" | |
working-directory: ./test/e2e | |
e2e-test-all-docker-compose: | |
runs-on: ubuntu-latest | |
needs: | |
- docker-compose-build | |
- make-browserslist | |
strategy: | |
matrix: | |
browser_name: ["chrome", "electron", "edge"] | |
include: ${{fromJson(needs.make-browserslist.outputs.browserslist)}} | |
env: | |
DOCKER_CONTENT_TRUST: 1 | |
REPOSITORY: ${{github.repository}} | |
steps: | |
- uses: actions/[email protected] | |
- run: cat .env >>"$GITHUB_ENV" | |
- run: echo "TAG_NAME=${HEAD_REF//\//-}" >> "$GITHUB_ENV" | |
env: | |
HEAD_REF: ${{github.head_ref || github.event.merge_group.head_ref}} | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/run_docker_compose.sh" | |
- uses: actions/[email protected] | |
with: | |
node-version-file: test/e2e/.node-version | |
cache: npm | |
cache-dependency-path: test/e2e/package-lock.json | |
- uses: browser-actions/[email protected] | |
if: matrix.browser_name == 'firefox' | |
with: | |
firefox-version: ${{ matrix.browser_version }} | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/set_docker_compose_test_env.sh" | |
- env: | |
BROWSER_NAME: ${{ matrix.browser_name }} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/run_all_test.sh" | |
working-directory: ./test/e2e | |
deploy-app-engine: | |
runs-on: ubuntu-latest | |
needs: | |
- build-frontend | |
- e2e-test-mini-docker-compose | |
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 | |
contents: read | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
name: frontend | |
path: frontend/dist | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/deploy_app_engine/set_config.sh" | |
if: github.event_name == 'pull_request' || github.event_name == 'merge_group' | |
- run: 'echo -e "env_variables:\n ENV_NAME: \"prd\"" >> app.yaml' | |
if: ${{ github.event_name == 'push' }} | |
- id: 'auth' | |
name: 'Authenticate to GCP' | |
uses: google-github-actions/[email protected] | |
with: | |
workload_identity_provider: ${{env.GCP_WORKLOAD_IDENTITY_PROVIDER}} | |
service_account: ${{env.GCP_SERVICE_ACCOUNT}} | |
- uses: google-github-actions/[email protected] | |
- name: Deploy to App Engine | |
uses: google-github-actions/[email protected] | |
with: | |
deliverables: app.yaml | |
project_id: hato-atama | |
promote: false | |
version: "v${{github.run_number}}" | |
- name: Wait for the deployment to complete | |
env: | |
RUN_NUMBER: ${{github.run_number}} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/deploy_app_engine/wait_for_deployment.sh" | |
create-pr-environment: | |
runs-on: ubuntu-latest | |
needs: deploy-app-engine | |
permissions: | |
pull-requests: write | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
env: | |
SHA: ${{github.event.pull_request.head.sha}} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/release/create_pr_environment/create_pr_environment.js`) | |
await script({github, context}) | |
lighthouse: | |
runs-on: ubuntu-latest | |
needs: deploy-app-engine | |
timeout-minutes: 1 | |
permissions: | |
pull-requests: write | |
env: | |
ARTIFACT_PATH: ${{ github.workspace }}/tmp/artifacts | |
URLS: https://v${{ github.run_number }}-dot-hato-atama.an.r.appspot.com | |
steps: | |
- uses: actions/[email protected] | |
- run: mkdir -p "${ARTIFACT_PATH}" | |
- uses: foo-software/[email protected] | |
with: | |
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }} | |
urls: ${{ env.URLS }} | |
outputDirectory: ${{ env.ARTIFACT_PATH }} | |
- uses: actions/[email protected] | |
with: | |
name: Lighthouse reports | |
path: ${{ env.ARTIFACT_PATH }} | |
e2e-test-mini-prd: | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
needs: | |
- deploy-app-engine | |
- e2e-test-mini-docker-compose | |
- make-browserslist | |
strategy: | |
matrix: | |
browser_name: ["chrome", "electron", "edge"] | |
include: ${{fromJson(needs.make-browserslist.outputs.browserslist)}} | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version-file: test/e2e/.node-version | |
cache: npm | |
cache-dependency-path: test/e2e/package-lock.json | |
- uses: browser-actions/[email protected] | |
if: matrix.browser_name == 'firefox' | |
with: | |
firefox-version: ${{ matrix.browser_version }} | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/set_prod_test_env.sh" | |
- env: | |
BROWSER_NAME: ${{ matrix.browser_name }} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/run_mini_test.sh" | |
working-directory: ./test/e2e | |
e2e-test-all-prd: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
needs: | |
- e2e-test-all-docker-compose | |
- e2e-test-mini-prd | |
- make-browserslist | |
strategy: | |
matrix: | |
browser_name: ["chrome", "electron", "edge"] | |
include: ${{fromJson(needs.make-browserslist.outputs.browserslist)}} | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version-file: test/e2e/.node-version | |
cache: npm | |
cache-dependency-path: test/e2e/package-lock.json | |
- uses: browser-actions/[email protected] | |
if: matrix.browser_name == 'firefox' | |
with: | |
firefox-version: ${{ matrix.browser_version }} | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/set_prod_test_env.sh" | |
- env: | |
BROWSER_NAME: ${{ matrix.browser_name }} | |
run: bash "${GITHUB_WORKSPACE}/scripts/release/run_all_test.sh" | |
working-directory: ./test/e2e | |
migrating-traffic: | |
runs-on: ubuntu-latest | |
needs: | |
- e2e-test-all-prd | |
if: ${{ github.event_name == 'push' }} | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/[email protected] | |
- id: 'auth' | |
name: 'Authenticate to GCP' | |
uses: google-github-actions/[email protected] | |
with: | |
workload_identity_provider: ${{env.GCP_WORKLOAD_IDENTITY_PROVIDER}} | |
service_account: ${{env.GCP_SERVICE_ACCOUNT}} | |
- uses: google-github-actions/[email protected] | |
- run: bash "${GITHUB_WORKSPACE}/scripts/release/migrating_traffic/set_traffic.sh" | |
remove-app-engine-past-versions: | |
runs-on: ubuntu-latest | |
needs: | |
- migrating-traffic | |
if: ${{ github.event_name == 'push' }} | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/[email protected] | |
- name: Get run numbers | |
uses: actions/[email protected] | |
id: get_run_numbers | |
env: | |
HEAD_REF: master | |
RUN_NUMBER: ${{github.run_number}} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
result-encoding: string | |
script: | | |
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/release/remove_app_engine_past_versions/get_run_numbers.js`) | |
return await script({github, context, core}) | |
- id: 'auth' | |
if: ${{ steps.get_run_numbers.outputs.result != '' }} | |
name: 'Authenticate to GCP' | |
uses: google-github-actions/[email protected] | |
with: | |
workload_identity_provider: ${{env.GCP_WORKLOAD_IDENTITY_PROVIDER}} | |
service_account: ${{env.GCP_SERVICE_ACCOUNT}} | |
- uses: google-github-actions/[email protected] | |
if: ${{ steps.get_run_numbers.outputs.result != '' }} | |
- 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' | |
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' | |
run: exit 1 | |
# PRをトリガーとした場合に完了しているべきjobが完了したか | |
# forkしたリポジトリからdev-hato/hato-atamaへPRを出した場合やforkしたリポジトリ上でPRを立てた場合、merge_groupトリガーの場合はcreate-pr-environmentがskipされていても完了したものと見なす | |
pr-test-complete: | |
runs-on: ubuntu-latest | |
if: always() && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'merge_group') | |
needs: | |
- 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') | |
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') | |
run: exit 1 | |
action-timeline-pr-test-complete: | |
needs: pr-test-complete | |
if: (github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'merge_group' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Kesin11/actions-timeline@v2 | |
# pushをトリガーとした場合に完了しているべきjobが完了したか | |
release-complete: | |
runs-on: ubuntu-latest | |
if: ${{ always() && github.event_name == 'push' }} | |
needs: | |
- release-complete-check | |
- remove-app-engine-past-versions | |
- check-deploy-diff | |
steps: | |
- if: needs.release-complete-check.result == 'success' && (github.repository != 'dev-hato/hato-atama' || needs.check-deploy-diff.outputs.deploy-files == 'false' || needs.remove-app-engine-past-versions.result == 'success') | |
run: exit 0 | |
- if: needs.release-complete-check.result != 'success' || (github.repository == 'dev-hato/hato-atama' && needs.check-deploy-diff.outputs.deploy-files == 'true' && needs.remove-app-engine-past-versions.result != 'success') | |
run: exit 1 | |
action-timeline-release-complete: | |
needs: release-complete | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Kesin11/actions-timeline@v2 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true |