Release Manager [Dispatch] #23
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 Manager [Dispatch]" | |
on: | |
workflow_dispatch: | |
inputs: | |
merge: | |
type: boolean | |
description: 'MERGE RELEASE BRANCH TO MAIN' | |
default: false | |
#version_increment_type: | |
# type: choice | |
# description: 'VERSION INCREMENT TYPE' | |
# default: 'patch' | |
# required: false | |
# options: | |
# - 'major' | |
# - 'minor' | |
# - 'patch' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
get-pr: | |
runs-on: ubuntu-latest | |
outputs: | |
pr_number: ${{ steps.get_pr.outputs.pr_number }} | |
steps: | |
- uses: actions/checkout@v4 | |
# headがrelease/かつ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 | |
id: get_pr | |
merge: | |
uses: joinmisskey/release-actions/.github/workflows/merge.yml@main | |
needs: get-pr | |
if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge == true }} | |
with: | |
pr_number: ${{ needs.get-pr.outputs.pr_number }} | |
main: ${{ github.ref_name }} | |
user: LuckyBeast | |
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} | |
secrets: | |
RULESET_EDIT_APP_ID: ${{ secrets.RULESET_EDIT_APP_ID }} | |
RULESET_EDIT_APP_PRIVATE_KEY: ${{ secrets.RULESET_EDIT_APP_PRIVATE_KEY }} | |
create-prerelease: | |
uses: joinmisskey/release-actions/.github/workflows/create-prerelease.yml@main | |
needs: get-pr | |
if: ${{ needs.get-pr.outputs.pr_number != '' && inputs.merge != true }} | |
with: | |
pr_number: ${{ needs.get-pr.outputs.pr_number }} | |
user: LuckyBeast | |
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} | |
create-target: | |
uses: joinmisskey/release-actions/.github/workflows/create-target.yml@main | |
needs: get-pr | |
if: ${{ needs.get-pr.outputs.pr_number == '' }} | |
with: | |
user: LuckyBeast | |
version_increment_type: ${{ inputs.version_increment_type }} | |
version_increment_script: | | |
const now = new Date(); | |
const year = now.toLocaleDateString('en-US', { year: 'numeric', timeZone: 'Asia/Tokyo' }); | |
const month = now.toLocaleDateString('en-US', { month: 'numeric', timeZone: 'Asia/Tokyo' }); | |
const [major, minor, _patch] = process.env.CURRENT_VERSION.split('.'); | |
const patch = Number(_patch.split('-')[0]); | |
if (Number.isNaN(patch)) { | |
console.error('Invalid patch version', year, month, process.env.CURRENT_VERSION, major, minor, _patch); | |
throw new Error('Invalid patch version'); | |
} | |
if (year !== major || month !== minor) { | |
return `${year}.${month}.0`; | |
} else { | |
return `${major}.${minor}.${patch + 1}`; | |
} | |
package_jsons_to_rewrite: ${{ vars.PACKAGE_JSONS_TO_REWRITE }} | |
secrets: | |
RULESET_EDIT_APP_ID: ${{ secrets.RULESET_EDIT_APP_ID }} | |
RULESET_EDIT_APP_PRIVATE_KEY: ${{ secrets.RULESET_EDIT_APP_PRIVATE_KEY }} |