From c4a80d7b78d51f597f152083680a5d2f218afcce Mon Sep 17 00:00:00 2001 From: Ben Woo <30431861+benwoo1110@users.noreply.github.com> Date: Mon, 21 Aug 2023 23:22:35 +0800 Subject: [PATCH] feat: use new semantic release action for release promote --- .github/workflows/promote_release.yml | 67 ++++++--------------------- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git a/.github/workflows/promote_release.yml b/.github/workflows/promote_release.yml index 63547184..3baccf08 100644 --- a/.github/workflows/promote_release.yml +++ b/.github/workflows/promote_release.yml @@ -1,4 +1,4 @@ -name: Manually promote last prerelease to release +name: Manually promote prerelease to release on: workflow_dispatch: @@ -6,14 +6,6 @@ on: version: description: 'Version to promote' required: true - version-bump: - description: 'Version bump to apply - should usually match the version bump used for the prerelease since last release' - required: true - type: choice - options: - - 'patch' - - 'minor' - - 'major' jobs: manually_promote_release: @@ -47,31 +39,20 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - - name: Remove prerelease tag - run: | - echo "Removing prerelease tag from version" - echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV - - - name: Build + - name: Build and test uses: gradle/gradle-build-action@v2 with: - arguments: clean build -x test -x checkstyleMain -x checkstyleTest + arguments: clean build -x assemble -x shadowJar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_VERSION: ${{ env.VERSION }} - name: Create release id: release - uses: Multiverse/release-on-push-action@skip_prs - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: benwoo1110/semantic-release-action@main with: - bump_version_scheme: ${{ github.event.inputs.version-bump }} - tag_prefix: '' - release_name: "" - use_github_release_notes: true - ref: ${{ steps.get-release.outputs.target_commitish }} - skip_prs: true + github_token: ${{ secrets.GITHUB_TOKEN }} + version_bump: promote + promote_from: ${{ github.event.inputs.version }} - name: Publish package uses: gradle/gradle-build-action@v2 @@ -79,42 +60,24 @@ jobs: arguments: publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_VERSION: ${{ env.VERSION }} + GITHUB_VERSION: ${{ steps.release.outputs.publish_version }} - name: Upload release artifact uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/libs/multiverse-core-${{ env.VERSION }}.jar + file: build/libs/multiverse-core-${{ steps.release.outputs.publish_version }}.jar asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar tag: ${{ steps.release.outputs.tag_name }} - - name: Get release info - id: release-info - uses: cardinalby/git-get-release-action@1.2.4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag: ${{ steps.release.outputs.tag_name }} - - name: Download release artifact id: release-artifact - uses: dsaltares/fetch-gh-release-asset@master + uses: dsaltares/fetch-gh-release-asset@v1 with: token: ${{ secrets.GITHUB_TOKEN }} version: tags/${{ steps.release.outputs.tag_name }} file: multiverse-core-${{ github.event.inputs.version }}.jar - - name: Parse release type - run: | - if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then - echo "Replacing prerelease version scheme with SNAPSHOT" - echo "RELEASE_TYPE=beta" >> $GITHUB_ENV - else - echo "Using release version scheme" - echo "RELEASE_TYPE=release" >> $GITHUB_ENV - fi - - name: Upload to modrinth.com uses: gradle/gradle-build-action@v2 with: @@ -122,18 +85,18 @@ jobs: env: GITHUB_VERSION: ${{ env.VERSION }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - CHANGELOG: ${{ steps.release-artifact.outputs.body }} + CHANGELOG: ${{ steps.release.outputs.body }} VERSION_NUMBER: ${{ steps.release.outputs.tag_name }} VERSION_TYPE: ${{ env.RELEASE_TYPE }} - name: Upload to dev.bukkit.org - uses: benwoo1110/dbo-upload-action@v0.1.0 + uses: benwoo1110/dbo-upload-action@v0.2.0 with: api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }} project_id: 30765 - changelog: ${{ steps.release-artifact.outputs.body }} + changelog: ${{ steps.release.outputs.body }} changelog_type: markdown - display_name: ${{ steps.release-artifact.outputs.version }} + display_name: ${{ steps.release.outputs.tag_name }} game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1 release_type: ${{ env.RELEASE_TYPE }} project_relations: > @@ -143,4 +106,4 @@ jobs: {"slug": "multiverse-signportals", "type": "optionalDependency"}, {"slug": "multiverse-inventories", "type": "optionalDependency"} ] - file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar + file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release.outputs.tag_name }}.jar