|
| 1 | +name: "Release Manager [Dispatch]" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + ## Specify the type of the next release. |
| 7 | + #version_increment_type: |
| 8 | + # type: choice |
| 9 | + # description: 'VERSION INCREMENT TYPE' |
| 10 | + # default: 'patch' |
| 11 | + # required: false |
| 12 | + # options: |
| 13 | + # - 'major' |
| 14 | + # - 'minor' |
| 15 | + # - 'patch' |
| 16 | + merge: |
| 17 | + type: boolean |
| 18 | + description: 'MERGE RELEASE BRANCH TO MAIN' |
| 19 | + default: false |
| 20 | + |
| 21 | +env: |
| 22 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: write |
| 26 | + issues: write |
| 27 | + pull-requests: write |
| 28 | + |
| 29 | +jobs: |
| 30 | + get-pr: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + outputs: |
| 33 | + pr_number: ${{ steps.get_pr.outputs.pr_number }} |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + # headがrelease/かつopenのPRを1つ取得 |
| 37 | + - name: Get PRs |
| 38 | + run: | |
| 39 | + echo "pr_number=$(gh pr list --limit 1 --search "head:release/ is:open" --json number --jq '.[] | .number')" >> $GITHUB_OUTPUT |
| 40 | + id: get_pr |
| 41 | + |
| 42 | + merge: |
| 43 | + uses: misskey-dev/release-manager-actions/.github/workflows/merge.yml@v1 |
| 44 | + needs: get-pr |
| 45 | + if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge == true }} |
| 46 | + with: |
| 47 | + pr_number: ${{ needs.get-pr.outputs.pr_number }} |
| 48 | + package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} |
| 49 | + # Text to prepend to the changelog |
| 50 | + # The first line must be `## Unreleased` |
| 51 | + changes_template: | |
| 52 | + ## Unreleased |
| 53 | +
|
| 54 | + ### General |
| 55 | + - |
| 56 | +
|
| 57 | + ### Client |
| 58 | + - |
| 59 | +
|
| 60 | + ### Server |
| 61 | + - |
| 62 | +
|
| 63 | + use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} |
| 64 | + secrets: |
| 65 | + RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} |
| 66 | + RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} |
| 67 | + RULESET_EDIT_APP_ID: ${{ secrets.RULESET_EDIT_APP_ID }} |
| 68 | + RULESET_EDIT_APP_PRIVATE_KEY: ${{ secrets.RULESET_EDIT_APP_PRIVATE_KEY }} |
| 69 | + |
| 70 | + create-prerelease: |
| 71 | + uses: misskey-dev/release-manager-actions/.github/workflows/create-prerelease.yml@v1 |
| 72 | + needs: get-pr |
| 73 | + if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge != true }} |
| 74 | + with: |
| 75 | + pr_number: ${{ needs.get-pr.outputs.pr_number }} |
| 76 | + package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} |
| 77 | + use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} |
| 78 | + secrets: |
| 79 | + RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} |
| 80 | + RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} |
| 81 | + |
| 82 | + create-target: |
| 83 | + uses: misskey-dev/release-manager-actions/.github/workflows/create-target.yml@v1 |
| 84 | + needs: get-pr |
| 85 | + if: ${{ needs.get-pr.outputs.pr_number == '' }} |
| 86 | + with: |
| 87 | + # The script for version increment. |
| 88 | + # process.env.CURRENT_VERSION: The current version. |
| 89 | + # |
| 90 | + # Misskey calender versioning (yyyy.MM.patch) example |
| 91 | + version_increment_script: | |
| 92 | + const now = new Date(); |
| 93 | + const year = now.toLocaleDateString('en-US', { year: 'numeric', timeZone: 'Asia/Tokyo' }); |
| 94 | + const month = now.toLocaleDateString('en-US', { month: 'numeric', timeZone: 'Asia/Tokyo' }); |
| 95 | + const [major, minor, _patch] = process.env.CURRENT_VERSION.split('.'); |
| 96 | + const patch = Number(_patch.split('-')[0]); |
| 97 | + if (Number.isNaN(patch)) { |
| 98 | + console.error('Invalid patch version', year, month, process.env.CURRENT_VERSION, major, minor, _patch); |
| 99 | + throw new Error('Invalid patch version'); |
| 100 | + } |
| 101 | + if (year !== major || month !== minor) { |
| 102 | + return `${year}.${month}.0`; |
| 103 | + } else { |
| 104 | + return `${major}.${minor}.${patch + 1}`; |
| 105 | + } |
| 106 | + ##Semver example |
| 107 | + #version_increment_script: | |
| 108 | + # const [major, minor, patch] = process.env.CURRENT_VERSION.split('.'); |
| 109 | + # if ("${{ inputs.version_increment_type }}" === "major") { |
| 110 | + # return `${Number(major) + 1}.0.0`; |
| 111 | + # } else if ("${{ inputs.version_increment_type }}" === "minor") { |
| 112 | + # return `${major}.${Number(minor) + 1}.0`; |
| 113 | + # } else { |
| 114 | + # return `${major}.${minor}.${Number(patch) + 1}`; |
| 115 | + # } |
| 116 | + package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} |
| 117 | + use_external_app_to_release: ${{ vars.USE_RELEASE_APP == 'true' }} |
| 118 | + secrets: |
| 119 | + RELEASE_APP_ID: ${{ secrets.RELEASE_APP_ID }} |
| 120 | + RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} |
| 121 | + RULESET_EDIT_APP_ID: ${{ secrets.RULESET_EDIT_APP_ID }} |
| 122 | + RULESET_EDIT_APP_PRIVATE_KEY: ${{ secrets.RULESET_EDIT_APP_PRIVATE_KEY }} |
0 commit comments