From 5de63b3495588ced1ba514370db857eeed879943 Mon Sep 17 00:00:00 2001 From: bd_ Date: Sun, 9 Mar 2025 20:12:49 -0700 Subject: [PATCH] ci: fixing issues with releaser workflow --- .github/workflows/perform-release.yml | 41 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/workflows/perform-release.yml b/.github/workflows/perform-release.yml index 1fb4310c..6c1bbb67 100644 --- a/.github/workflows/perform-release.yml +++ b/.github/workflows/perform-release.yml @@ -46,7 +46,7 @@ jobs: uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main create-release: - needs: [check-gameci, check-docs] + needs: [ check-gameci, check-docs ] runs-on: ubuntu-latest steps: @@ -55,22 +55,29 @@ jobs: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" + # https://github.com/orgs/community/discussions/13836#discussioncomment-8535364 + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASER_APP_ID }} + private-key: ${{ secrets.RELEASER_PRIVATE_KEY }} + - name: Validate prerelease version id: check-version if: ${{ github.event.inputs.release_kind == 'prerelease' && !contains(github.event.inputs.version, '-') }} run: echo "Prerelease version must contain a hyphen" exit 1 - + - name: Validate stable version id: check-version-stable if: ${{ github.event.inputs.release_kind == 'stable' && contains(github.event.inputs.version, '-') }} run: echo "Stable version must not contain a hyphen" exit 1 - + - name: Validate adhoc - id: validate-adhocc + id: validate-adhoc if: ${{ github.event.inputs.release_kind == 'adhoc' && github.event.inputs.publish == 'true' }} run: echo "Adhoc release cannot be published" @@ -80,9 +87,9 @@ jobs: run: | echo "zipFile=${{ env.PKG_NAME }}-${{ github.event.inputs.version }}".zip >> $GITHUB_ENV echo "unityPackage=${{ env.PKG_NAME }}-${{ github.event.inputs.version }}.unitypackage" >> $GITHUB_ENV - + echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV - + case "$RELEASE_TYPE" in prerelease) echo "PRERELEASE=true" >> $GITHUB_ENV @@ -99,14 +106,15 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - + token: ${{ steps.app-token.outputs.token }} + - name: Check semver syntax if: steps.check-tag.outputs.need-new-tag == 'true' id: semver-check run: | chmod +x .github/workflows/*.sh .github/workflows/check-semver-syntax.sh ${{ github.event.inputs.version }} - + - name: Set git user and email id: git-config run: | @@ -119,22 +127,20 @@ jobs: mv package.json.tmp package.json env: VERSION: ${{ github.event.inputs.version }} - + + - name: Update changelog id: changelog run: | chmod +x .github/*.pl - + if [ "${{ env.PRERELEASE }}" == "true" ]; then ./.github/cut-changelog.pl CHANGELOG-PRERELEASE.md .github/CHANGELOG-HEADER.md ${{ env.VERSION }} .github/relnote-en.md - ./.github/cut-changelog.pl CHANGELOG-PRERELEASE-jp.md .github/CHANGELOG-HEADER.md ${{ env.VERSION }} .github/relnote-jp.md else ./.github/cut-changelog.pl CHANGELOG-PRERELEASE.md .github/CHANGELOG-HEADER.md ${{ env.VERSION }} - ./.github/cut-changelog.pl CHANGELOG-PRERELEASE-jp.md .github/CHANGELOG-HEADER.md ${{ env.VERSION }} ./.github/cut-changelog.pl CHANGELOG.md .github/CHANGELOG-HEADER.md ${{ env.VERSION }} .github/relnote-en.md - ./.github/cut-changelog.pl CHANGELOG-jp.md .github/CHANGELOG-HEADER.md ${{ env.VERSION }} .github/relnote-jp.md fi - + echo Version ${{ env.VERSION }} > release-note.md echo >> release-note.md if [ "${{ env.PRERELEASE }}" == "true" ]; then @@ -144,8 +150,6 @@ jobs: fi echo '## Notable changes' >> release-note.md cat .github/relnote-en.md >> release-note.md - echo '## 主な変更点' >> release-note.md - cat .github/relnote-jp.md >> release-note.md - name: Upload CHANGELOG.md if: ${{ github.event.inputs.release_kind == 'stable' }} @@ -173,7 +177,10 @@ jobs: - name: Publish tag if: ${{ github.event.inputs.publish == 'true' }} run: | - git push origin ${{ github.event.workflow_dispatch.base.ref }} ${{ github.event.inputs.version }} + BRANCH_NAME=$(git branch --show-current) + git push origin $BRANCH_NAME && git push origin ${{ github.event.inputs.version }} + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} - name: Create Zip run: |