-
Notifications
You must be signed in to change notification settings - Fork 6
61 lines (51 loc) · 1.62 KB
/
Copy pathrelease.yml
File metadata and controls
61 lines (51 loc) · 1.62 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
name: Release tagged build
on:
push:
tags: [ 'v*' ]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ github.ref_name }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
steps:
- name: Check out source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: |
8
17
21
25
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Resolve release version
run: |
RELEASE_VERSION="${RELEASE_TAG#v}"
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_ENV"
- name: Build release artifacts
run: ./gradlew build -Pmod_version="${RELEASE_VERSION}"
- name: Create GitHub release
run: gh release create "$RELEASE_TAG" build/libs/* --title "$RELEASE_TAG" --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to CurseForge
if: env.CURSEFORGE_TOKEN != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
changelog_file="${RUNNER_TEMP}/curseforge-changelog.md"
: > "${changelog_file}"
gh release view "${RELEASE_TAG}" --json body --jq .body > "${changelog_file}"
./gradlew publishCurseForge \
-Pmod_version="${RELEASE_VERSION}" \
"-Pcurseforge_changelog_file=${changelog_file}"