feat: Use new semantic release action

This commit is contained in:
Ben Woo 2023-08-21 23:00:00 +08:00
parent bf72328c37
commit 356d67edf4
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8

View File

@ -19,7 +19,7 @@ jobs:
- name: Validate Gradle wrapper - name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Test & Build - name: Build and test
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: clean build -x assemble -x shadowJar arguments: clean build -x assemble -x shadowJar
@ -28,88 +28,61 @@ jobs:
- name: Create release - name: Create release
id: release id: release
uses: Multiverse/release-on-push-action@support_prerelease uses: benwoo1110/semantic-release-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
bump_version_scheme: norelease github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: '' version_bump: prlabel
release_name: "<RELEASE_VERSION>" release_mode: prerelease
use_github_release_notes: true
- name: Modify version scheme
run: |
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
echo "Replacing prerelease version scheme with SNAPSHOT"
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
else
echo "Using release version scheme"
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
fi
- name: Publish package - name: Publish package
if: steps.release.outputs.release_created == 'true'
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: publish arguments: publish
env: env:
GITHUB_VERSION: ${{ env.VERSION }} GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact - name: Upload release artifact
if: steps.release.outputs.release_created == 'true'
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} 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 asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
tag: ${{ steps.release.outputs.tag_name }} 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 - name: Download release artifact
id: release-artifact if: steps.release.outputs.release_created == 'true'
uses: dsaltares/fetch-gh-release-asset@master uses: dsaltares/fetch-gh-release-asset@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
version: tags/${{ steps.release.outputs.tag_name }} version: tags/${{ steps.release.outputs.tag_name }}
file: multiverse-core-${{ github.event.inputs.version }}.jar 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 - name: Upload to modrinth.com
if: steps.release.outputs.release_created == 'true'
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: build modrinth arguments: build modrinth -x checkstyleMain -x checkstyleTest
env: env:
GITHUB_VERSION: ${{ env.VERSION }} GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.release-artifact.outputs.body }} CHANGELOG: ${{ steps.release.outputs.body }}
VERSION_NUMBER: ${{ steps.release.outputs.tag_name }} VERSION_NUMBER: ${{ steps.release.outputs.tag_name }}
VERSION_TYPE: ${{ env.RELEASE_TYPE }} VERSION_TYPE: ${{ steps.release.outputs.release_type }}
- name: Upload to dev.bukkit.org - name: Upload to dev.bukkit.org
uses: benwoo1110/dbo-upload-action@v0.1.0 if: steps.release.outputs.release_created == 'true'
uses: benwoo1110/dbo-upload-action@v0.2.0
with: with:
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }} api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
project_id: 30765 project_id: 30765
changelog: ${{ steps.release-artifact.outputs.body }} changelog: ${{ steps.release.outputs.body }}
changelog_type: markdown 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 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 }} release_type: ${{ steps.release.outputs.release_type }}
project_relations: > project_relations: >
[ [
{"slug": "multiverse-portals", "type": "optionalDependency"}, {"slug": "multiverse-portals", "type": "optionalDependency"},
@ -117,4 +90,4 @@ jobs:
{"slug": "multiverse-signportals", "type": "optionalDependency"}, {"slug": "multiverse-signportals", "type": "optionalDependency"},
{"slug": "multiverse-inventories", "type": "optionalDependency"} {"slug": "multiverse-inventories", "type": "optionalDependency"}
] ]
file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar file_path: ${{ github.workspace }}/multiverse-core-${{ steps.release.outputs.tag_name }}.jar