generated from Liams-Services/PaperMC-Plugin-Boilerplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 2.04 KB
/
release.yml
File metadata and controls
68 lines (59 loc) · 2.04 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
name: Release
# CalVer tags (YYYY.MM.DD), e.g. 2026.03.23. Pushes to main build a prerelease snapshot.
on:
push:
tags:
# Years 2000–2099, three dot-separated segments (matches CalVer release tags)
- "20[0-9][0-9].*.*"
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve version and release tag
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
TAG="${GITHUB_REF_NAME}"
if ! echo "$TAG" | grep -qE '^[12][0-9]{3}\.[0-9]{2}\.[0-9]{2}$'; then
echo "::error::Release tag must be CalVer YYYY.MM.DD (e.g. 2026.03.23), got: $TAG"
exit 1
fi
echo "VERSION=${TAG}" >> "$GITHUB_ENV"
echo "RELEASE_TAG=${TAG}" >> "$GITHUB_ENV"
echo "PRERELEASE=false" >> "$GITHUB_ENV"
else
DAY="$(date -u +'%Y.%m.%d')"
SNAP="${DAY}.snapshot.${GITHUB_RUN_NUMBER}"
echo "VERSION=${SNAP}" >> "$GITHUB_ENV"
echo "RELEASE_TAG=${SNAP}" >> "$GITHUB_ENV"
echo "PRERELEASE=true" >> "$GITHUB_ENV"
fi
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build jar
run: ./gradlew build --no-daemon
env:
VERSION_OVERRIDE: ${{ env.VERSION }}
- name: Create GitHub release and upload jar
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: ${{ env.VERSION }}
generate_release_notes: true
prerelease: ${{ env.PRERELEASE == 'true' }}
fail_on_unmatched_files: true
files: build/libs/WorldEngine-*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}