Bump release actions to v2 (develop-stable(master) branches system) (#13941)

This commit is contained in:
tamaina 2024-07-09 16:08:49 +09:00 committed by GitHub
parent 55c990e0d9
commit b61f270eae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 20 deletions

View file

@ -3,7 +3,7 @@ name: "Release Manager: sync changelog with PR"
on: on:
push: push:
branches: branches:
- release/** - develop
paths: paths:
- 'CHANGELOG.md' - 'CHANGELOG.md'
@ -20,17 +20,19 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# headがrelease/かつopenのPRを1つ取得 # headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得
- name: Get PR - name: Get PR
run: | 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 id: get_pr
env:
STABLE_BRANCH: ${{ vars.STABLE_BRANCH }}
- name: Get target version - 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 id: v
# CHANGELOG.mdの内容を取得 # CHANGELOG.mdの内容を取得
- name: Get changelog - 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: with:
version: ${{ steps.v.outputs.target_version }} version: ${{ steps.v.outputs.target_version }}
id: changelog id: changelog
@ -39,5 +41,5 @@ jobs:
run: | run: |
gh pr edit "$PR_NUMBER" --body "$CHANGELOG" gh pr edit "$PR_NUMBER" --body "$CHANGELOG"
env: env:
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
PR_NUMBER: ${{ steps.get_pr.outputs.pr_number }} PR_NUMBER: ${{ steps.get_pr.outputs.pr_number }}
CHANGELOG: ${{ steps.changelog.outputs.changelog }}

View file

@ -33,18 +33,21 @@ jobs:
pr_number: ${{ steps.get_pr.outputs.pr_number }} pr_number: ${{ steps.get_pr.outputs.pr_number }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# headがrelease/かつopenのPRを1つ取得 # headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得
- name: Get PRs - name: Get PRs
run: | 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 id: get_pr
env:
STABLE_BRANCH: ${{ vars.STABLE_BRANCH }}
merge: 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 needs: get-pr
if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge == true }} if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge == true }}
with: with:
pr_number: ${{ needs.get-pr.outputs.pr_number }} pr_number: ${{ needs.get-pr.outputs.pr_number }}
user: 'github-actions[bot]'
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }}
# Text to prepend to the changelog # Text to prepend to the changelog
# The first line must be `## Unreleased` # The first line must be `## Unreleased`
@ -65,15 +68,14 @@ jobs:
secrets: secrets:
RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }}
RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} 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: 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 needs: get-pr
if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge != true }} if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge != true }}
with: with:
pr_number: ${{ needs.get-pr.outputs.pr_number }} pr_number: ${{ needs.get-pr.outputs.pr_number }}
user: 'github-actions[bot]'
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }}
use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }}
indent: ${{ vars.INDENT }} indent: ${{ vars.INDENT }}
@ -82,10 +84,11 @@ jobs:
RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
create-target: 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 needs: get-pr
if: ${{ needs.get-pr.outputs.pr_number == '' }} if: ${{ needs.get-pr.outputs.pr_number == '' }}
with: with:
user: 'github-actions[bot]'
# The script for version increment. # The script for version increment.
# process.env.CURRENT_VERSION: The current version. # process.env.CURRENT_VERSION: The current version.
# #
@ -118,8 +121,7 @@ jobs:
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }}
use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }}
indent: ${{ vars.INDENT }} indent: ${{ vars.INDENT }}
stable_branch: ${{ vars.STABLE_BRANCH }}
secrets: secrets:
RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }}
RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} 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 }}

View file

@ -16,23 +16,26 @@ jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
ref: ${{ steps.get_pr.outputs.ref }} head: ${{ steps.get_pr.outputs.head }}
base: ${{ steps.get_pr.outputs.base }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# PR情報を取得 # PR情報を取得
- name: Get PR - name: Get PR
run: | run: |
pr_json=$(gh pr view "$PR_NUMBER" --json isDraft,headRefName) pr_json=$(gh pr view "$PR_NUMBER" --json isDraft,headRefName,baseRefName)
echo "ref=$(echo $pr_json | jq -r '.headRefName')" >> $GITHUB_OUTPUT echo "head=$(echo $pr_json | jq -r '.headRefName')" >> $GITHUB_OUTPUT
echo "base=$(echo $pr_json | jq -r '.baseRefName')" >> $GITHUB_OUTPUT
id: get_pr id: get_pr
env: env:
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
release: 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 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: with:
pr_number: ${{ github.event.pull_request.number }} pr_number: ${{ github.event.pull_request.number }}
user: 'github-actions[bot]'
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }}
use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }}
indent: ${{ vars.INDENT }} indent: ${{ vars.INDENT }}