-
Notifications
You must be signed in to change notification settings - Fork 11
83 lines (72 loc) · 2.53 KB
/
release.yml
File metadata and controls
83 lines (72 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release Build
on:
push:
branches:
- master
# Suppress Node.js 20 deprecation warnings by explicitly opting into Node 24
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to generate a changelog from git history
- name: ☕ Set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: 🏷 Get and Clean Version from pom.xml
id: version
run: |
RAW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
CLEAN_VERSION=$(echo $RAW_VERSION | cut -d'-' -f1)
echo "VERSION=$CLEAN_VERSION" >> $GITHUB_ENV
echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUT
- name: 📝 Generate Changelog
id: changelog
run: |
# Gets commits between the last two tags, or all commits if no tags exist
# Formats as: hash message - author
CHANGELOG=$(git log --pretty=format:"%h %s - %an" -n 10)
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: 🛠 Build Production JAR
run: |
mvn clean package -Drevision=${{ env.VERSION }}
- name: 📦 Prepare Release Artifacts
run: |
mkdir -p dist
JAR=$(find target -name "AutoPickup-${{ env.VERSION }}.jar" | head -n1)
if [ -z "$JAR" ]; then
echo "❌ JAR not found"
exit 1
fi
cp "$JAR" "dist/AutoPickup-${{ env.VERSION }}.jar"
- name: 📥 Upload to Modrinth
uses: modrinth/minotaur@v2
with:
token: ${{ secrets.MODRINTH_TOKEN }} # You must add this to GitHub Secrets
project-id: "oB3hT7d7" # Replace with your Modrinth Project ID or Slug
version-number: ${{ env.VERSION }}
version-name: "AutoPickup ${{ env.VERSION }}"
version-type: "release"
changelog: ${{ steps.changelog.outputs.changelog }}
loaders: |
paper
purpur
spigot
game-versions: |
1.21
1.21.1
files: dist/*.jar
- name: 📥 Upload Artifact to GitHub
uses: actions/upload-artifact@v4
with:
name: AutoPickup-${{ env.VERSION }}-RELEASE
path: dist/*.jar