-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (60 loc) · 1.77 KB
/
release.yml
File metadata and controls
74 lines (60 loc) · 1.77 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
name: Release
on:
release:
types:
- published
permissions:
contents: write
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 25
distribution: temurin
cache: gradle
- name: Prepare release metadata
id: metadata
shell: bash
run: |
set -euo pipefail
release_name="$(jq -r '.release.name // ""' "$GITHUB_EVENT_PATH")"
notes="$(jq -r '.release.body // ""' "$GITHUB_EVENT_PATH")"
if [ -z "$notes" ]; then
notes="${release_name:-Release}"
fi
{
echo "changelog<<EOF"
printf '%s\n' "$notes"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Publish release
run: ./gradlew publishMods
env:
CHANGELOG: ${{ steps.metadata.outputs.changelog }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
- name: Locate release jars
id: artifacts
shell: bash
run: |
set -euo pipefail
mapfile -t all_jars < <(find versions -path '*/build/libs/*.jar' -type f | sort)
if [ "${#all_jars[@]}" -eq 0 ]; then
echo "No jars found under versions/*/build/libs" >&2
exit 1
fi
{
echo "all_files<<EOF"
printf '%s\n' "${all_jars[@]}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Attach jars to GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name }}
files: ${{ steps.artifacts.outputs.all_files }}