-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (91 loc) · 3.02 KB
/
Copy pathrelease.yml
File metadata and controls
106 lines (91 loc) · 3.02 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Strip v prefix from VERSION
run: |
echo "VERSION_STRIPPED=${VERSION#v}" >> $GITHUB_ENV
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build with Gradle ShadowJar
run: ./gradlew clean :plugin:shadowJar
env:
GPR_USER: ${{ github.actor }}
GPR_KEY: ${{ secrets.GPR_KEY }}
- name: Build API
# Don't run `clean` here — an additional clean will remove the plugin artifact
# produced by the previous step. Build only the API module to avoid deleting
# plugin/build/libs/HyphaShop-*.jar before release upload.
run: ./gradlew :api:build
env:
GPR_USER: ${{ github.actor }}
GPR_KEY: ${{ secrets.GPR_KEY }}
- name: List built artifacts (debug)
run: ls -la plugin/build/libs || true
- name: Detect release channel
id: channel
run: |
ver="${VERSION,,}"
if [[ "$ver" == *"alpha"* ]]; then
echo "value=alpha" >> $GITHUB_OUTPUT
elif [[ "$ver" == *"beta"* ]]; then
echo "value=beta" >> $GITHUB_OUTPUT
else
echo "value=release" >> $GITHUB_OUTPUT
fi
- name: Extract changelog for this version
id: changelog
run: |
VERSION=${VERSION#v}
echo "Extracting changelog for $VERSION"
awk -v ver="## $VERSION " '
$0 ~ ver {flag=1; next}
/^## / && flag {exit}
flag {print}
' CHANGELOG.md > RELEASE_CHANGELOG.md
echo "body<<EOF" >> $GITHUB_OUTPUT
cat RELEASE_CHANGELOG.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION_STRIPPED }}
body: ${{ steps.changelog.outputs.body }}
generate_release_notes: false
files: |
plugin/build/libs/HyphaShop-*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Modrinth
uses: cloudnode-pro/modrinth-publish@v2
with:
token: ${{ secrets.MODRINTH_TOKEN }}
project: SeLGgTIu
name: ${{ env.VERSION_STRIPPED }}
version: ${{ env.VERSION_STRIPPED }}
changelog: ${{ steps.changelog.outputs.body }}
channel: ${{ steps.detect-channel.outputs.channel }}
loaders: |-
paper
folia
purpur
game-versions: |-
1.21.x
files: plugin/build/libs/HyphaShop-${{ env.VERSION_STRIPPED }}.jar