Skip to content

Commit cf54b65

Browse files
committed
ci: improve release/publish CI
1 parent 583f78d commit cf54b65

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

.github/workflows/release.yaml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,55 @@ name: Maven Release
22

33
on:
44
release:
5-
types: [ published ]
5+
types: [published]
66

77
jobs:
8-
package-and-upload:
9-
name: Build and Upload JARs
8+
publish:
9+
name: Publish
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v3
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
1515

1616
- name: Set up Java
17-
uses: actions/setup-java@v3
17+
uses: actions/setup-java@v4
1818
with:
19-
java-version: '17'
20-
distribution: 'temurin'
19+
java-version: 17
20+
distribution: temurin
21+
cache: maven
2122

22-
- name: Set release version
23+
- name: Get release version from tag
2324
run: |
2425
TAG=${{ github.event.release.tag_name }}
2526
echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT
2627
id: version
2728

28-
- name: Set project version
29+
- name: Set project release version
2930
run: mvn -B versions:set -DnewVersion=${{ steps.version.outputs.VERSION }} -DgenerateBackupPoms=false
3031

3132
- name: Build and package Maven project
32-
run: mvn clean package
33+
run: mvn -B clean package --file pom.xml
3334

3435
- name: Upload to release
35-
uses: JasonEtco/upload-to-release@master
36+
uses: cloudnode-pro/release-upload-[email protected]
3637
with:
37-
args: target/EnchantBookPlus-${{ steps.version.outputs.VERSION }}.jar application/java-archive
38+
gh-token: ${{ github.token }}
39+
files: target/EnchantBookPlus-${{ steps.version.outputs.VERSION }}.jar; type=application/java-archive
3840
env:
3941
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4042

4143
- name: Upload to Modrinth
42-
uses: cloudnode-pro/modrinth-publish@1.0.0
44+
uses: cloudnode-pro/modrinth-publish@2.0.0
4345
with:
4446
token: '${{ secrets.MODRINTH_TOKEN }}'
4547
project: '${{ github.event.repository.custom_properties.modrinth_id }}'
46-
file: target/EnchantBookPlus-${{ steps.version.outputs.VERSION }}.jar
48+
name: ${{ github.event.release.name == github.event.release.tag_name && format('EnchantBookPlus {0}', steps.version.outputs.VERSION) || github.event.release.name }}
49+
version: ${{ steps.version.outputs.VERSION }}
4750
changelog: ${{ github.event.release.body }}
4851
loaders: paper
52+
game-versions: |-
53+
1.20.x
54+
1.21.x
55+
files: target/EnchantBookPlus-${{ steps.version.outputs.VERSION }}.jar
4956
dependencies: '[{"project_id":"N4CZEMrg","dependency_type":"optional"}]'

0 commit comments

Comments
 (0)