From b61f270eae18121357748a199ae3044304128a46 Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 9 Jul 2024 16:08:49 +0900 Subject: [PATCH] Bump release actions to v2 (develop-stable(master) branches system) (#13941) --- .github/workflows/release-edit-with-push.yml | 14 ++++++++------ .github/workflows/release-with-dispatch.yml | 20 +++++++++++--------- .github/workflows/release-with-ready.yml | 13 ++++++++----- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release-edit-with-push.yml b/.github/workflows/release-edit-with-push.yml index 86ee0b3fb5..e1bcb5a665 100644 --- a/.github/workflows/release-edit-with-push.yml +++ b/.github/workflows/release-edit-with-push.yml @@ -3,7 +3,7 @@ name: "Release Manager: sync changelog with PR" on: push: branches: - - release/** + - develop paths: - 'CHANGELOG.md' @@ -20,17 +20,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # headがrelease/かつopenのPRを1つ取得 + # headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得 - name: Get PR run: | - echo "pr_number=$(gh pr list --limit 1 --head "$GITHUB_REF_NAME" --json number --jq '.[] | .number')" >> $GITHUB_OUTPUT + echo "pr_number=$(gh pr list --limit 1 --search "head:$GITHUB_REF_NAME base:$STABLE_BRANCH is:open" --json number --jq '.[] | .number')" >> $GITHUB_OUTPUT id: get_pr + env: + STABLE_BRANCH: ${{ vars.STABLE_BRANCH }} - name: Get target version - uses: misskey-dev/release-manager-actions/.github/actions/get-target-version@v1 + uses: misskey-dev/release-manager-actions/.github/actions/get-target-version@v2 id: v # CHANGELOG.mdの内容を取得 - name: Get changelog - uses: misskey-dev/release-manager-actions/.github/actions/get-changelog@v1 + uses: misskey-dev/release-manager-actions/.github/actions/get-changelog@v2 with: version: ${{ steps.v.outputs.target_version }} id: changelog @@ -39,5 +41,5 @@ jobs: run: | gh pr edit "$PR_NUMBER" --body "$CHANGELOG" env: - CHANGELOG: ${{ steps.changelog.outputs.changelog }} PR_NUMBER: ${{ steps.get_pr.outputs.pr_number }} + CHANGELOG: ${{ steps.changelog.outputs.changelog }} diff --git a/.github/workflows/release-with-dispatch.yml b/.github/workflows/release-with-dispatch.yml index bc6448cb37..0936bc0ae8 100644 --- a/.github/workflows/release-with-dispatch.yml +++ b/.github/workflows/release-with-dispatch.yml @@ -33,18 +33,21 @@ jobs: pr_number: ${{ steps.get_pr.outputs.pr_number }} steps: - uses: actions/checkout@v4 - # headがrelease/かつopenのPRを1つ取得 + # headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得 - name: Get PRs run: | - echo "pr_number=$(gh pr list --limit 1 --search "head:release/ is:open" --json number --jq '.[] | .number')" >> $GITHUB_OUTPUT + echo "pr_number=$(gh pr list --limit 1 --search "head:$GITHUB_REF_NAME base:$STABLE_BRANCH is:open" --json number --jq '.[] | .number')" >> $GITHUB_OUTPUT id: get_pr + env: + STABLE_BRANCH: ${{ vars.STABLE_BRANCH }} merge: - uses: misskey-dev/release-manager-actions/.github/workflows/merge.yml@v1 + uses: misskey-dev/release-manager-actions/.github/workflows/merge.yml@v2 needs: get-pr if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge == true }} with: pr_number: ${{ needs.get-pr.outputs.pr_number }} + user: 'github-actions[bot]' package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} # Text to prepend to the changelog # The first line must be `## Unreleased` @@ -65,15 +68,14 @@ jobs: secrets: RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} - RULESET_EDIT_APP_ID: ${{ secrets.RULESET_EDIT_APP_ID }} - RULESET_EDIT_APP_PRIVATE_KEY: ${{ secrets.RULESET_EDIT_APP_PRIVATE_KEY }} create-prerelease: - uses: misskey-dev/release-manager-actions/.github/workflows/create-prerelease.yml@v1 + uses: misskey-dev/release-manager-actions/.github/workflows/create-prerelease.yml@v2 needs: get-pr if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge != true }} with: pr_number: ${{ needs.get-pr.outputs.pr_number }} + user: 'github-actions[bot]' package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} indent: ${{ vars.INDENT }} @@ -82,10 +84,11 @@ jobs: RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} create-target: - uses: misskey-dev/release-manager-actions/.github/workflows/create-target.yml@v1 + uses: misskey-dev/release-manager-actions/.github/workflows/create-target.yml@v2 needs: get-pr if: ${{ needs.get-pr.outputs.pr_number == '' }} with: + user: 'github-actions[bot]' # The script for version increment. # process.env.CURRENT_VERSION: The current version. # @@ -118,8 +121,7 @@ jobs: package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} indent: ${{ vars.INDENT }} + stable_branch: ${{ vars.STABLE_BRANCH }} secrets: RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} - RULESET_EDIT_APP_ID: ${{ secrets.RULESET_EDIT_APP_ID }} - RULESET_EDIT_APP_PRIVATE_KEY: ${{ secrets.RULESET_EDIT_APP_PRIVATE_KEY }} diff --git a/.github/workflows/release-with-ready.yml b/.github/workflows/release-with-ready.yml index a0fad0e336..79b6ade012 100644 --- a/.github/workflows/release-with-ready.yml +++ b/.github/workflows/release-with-ready.yml @@ -16,23 +16,26 @@ jobs: check: runs-on: ubuntu-latest outputs: - ref: ${{ steps.get_pr.outputs.ref }} + head: ${{ steps.get_pr.outputs.head }} + base: ${{ steps.get_pr.outputs.base }} steps: - uses: actions/checkout@v4 # PR情報を取得 - name: Get PR run: | - pr_json=$(gh pr view "$PR_NUMBER" --json isDraft,headRefName) - echo "ref=$(echo $pr_json | jq -r '.headRefName')" >> $GITHUB_OUTPUT + pr_json=$(gh pr view "$PR_NUMBER" --json isDraft,headRefName,baseRefName) + echo "head=$(echo $pr_json | jq -r '.headRefName')" >> $GITHUB_OUTPUT + echo "base=$(echo $pr_json | jq -r '.baseRefName')" >> $GITHUB_OUTPUT id: get_pr env: PR_NUMBER: ${{ github.event.pull_request.number }} release: - uses: misskey-dev/release-manager-actions/.github/workflows/create-prerelease.yml@v1 + uses: misskey-dev/release-manager-actions/.github/workflows/create-prerelease.yml@v2 needs: check - if: startsWith(needs.check.outputs.ref, 'release/') + if: needs.check.outputs.head == github.event.repository.default_branch && needs.check.outputs.base == vars.STABLE_BRANCH with: pr_number: ${{ github.event.pull_request.number }} + user: 'github-actions[bot]' package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} indent: ${{ vars.INDENT }}