Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

Commit c3529bd

Browse files
authored
ci: add verified UTC development and release builds (#2)
* ci: add verified UTC development and release builds * ci: integrate pinned Maven dependencies in verified pipelines
1 parent 49e2b5c commit c3529bd

8 files changed

Lines changed: 256 additions & 25 deletions

File tree

‎.github/dependencies.sha256‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
0116d714822b6f0cfebfe833a5df2e4754797b637d0fe709afb762c56da463a3 libs/ItemsAdder_3.5.0-r2.jar
2+
2d9484f4c649f708f47f9a479465fc729770ee65617dca3011836602264f6439 libs/json-simple-1.1.jar
3+
4241c14a7727c34feea6507ec801318a3d4a90f070e4525681079fb94ee4c593 libs/gson-2.10.1.jar
4+
d52cc0c734a9bb942428a403bb3630123596bcd9c94d3a77ea2782046b113af5 libs/MMOCore-1.11.3.jar
5+
c84700df5942fd969d3e8c2f1ad2c3ebeb17987ef88b426408d1306e49c4aada libs/MMOItems-6.10.jar
6+
660ff2a6ec86bc8d7779948cf65c1637e271a16e1ef812d6a273f4a5c5eec73c libs/MythicLib-1.7.jar
7+
97e0c708c1e319189ce1cda049244551a105860d51e908d2bcbc183fd1f89816 libs/spigot-api-1.20.2-R0.1-SNAPSHOT.jar
8+
575aa30aee8ef723ad36229eb6c4223bca6e4037d271ddccc8f23cf6faa69747 libs/MythicMobs-5.8.0-SNAPSHOT.jar

‎.github/scripts/prepare-release.sh‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
: "${GH_TOKEN:?Set DEPS_TOKEN with Contents read access to TF-Minecraft/ServerAssets}"
4+
ref=2fe025eb9879bab7dfe48e32395d8a8c1dff75f7
5+
mkdir -p libs
6+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/0116d714822b/ItemsAdder_3.5.0-r2.jar?ref=$ref" > "libs/ItemsAdder_3.5.0-r2.jar"
7+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/2d9484f4c649/json-simple-1.1.jar?ref=$ref" > "libs/json-simple-1.1.jar"
8+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/4241c14a7727/gson-2.10.1.jar?ref=$ref" > "libs/gson-2.10.1.jar"
9+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/d52cc0c734a9/MMOCore-1.11.3.jar?ref=$ref" > "libs/MMOCore-1.11.3.jar"
10+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/c84700df5942/MMOItems-6.10.jar?ref=$ref" > "libs/MMOItems-6.10.jar"
11+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/660ff2a6ec86/MythicLib-1.7.jar?ref=$ref" > "libs/MythicLib-1.7.jar"
12+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/97e0c708c1e3/spigot-api-1.20.2-R0.1-SNAPSHOT.jar?ref=$ref" > "libs/spigot-api-1.20.2-R0.1-SNAPSHOT.jar"
13+
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/575aa30aee8e/MythicMobs-5.8.0-SNAPSHOT.jar?ref=$ref" > "libs/MythicMobs-5.8.0-SNAPSHOT.jar"
14+
sha256sum --check .github/dependencies.sha256

‎.github/workflows/build.yml‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-24.04
15+
timeout-minutes: 20
16+
steps:
17+
- uses: actions/checkout@v7
18+
with:
19+
persist-credentials: false
20+
- uses: actions/setup-java@v6
21+
with:
22+
distribution: temurin
23+
java-version: '25'
24+
- name: Prepare pinned dependencies
25+
env:
26+
GH_TOKEN: ${{ secrets.DEPS_TOKEN }}
27+
run: bash .github/scripts/prepare-release.sh
28+
- name: Set dated development version
29+
id: dev
30+
shell: bash
31+
run: |
32+
dev_version="DEV-$(date -u +%Y%m%d-%H%M)"
33+
mvn -B --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.22.0:set \
34+
-DnewVersion="$dev_version" -DgenerateBackupPoms=false
35+
mvn -B --no-transfer-progress help:evaluate \
36+
-Dexpression=project.build.finalName -Doutput="$RUNNER_TEMP/final-name"
37+
final_name=$(cat "$RUNNER_TEMP/final-name")
38+
echo "name=$final_name" >> "$GITHUB_OUTPUT"
39+
echo "jar=target/$final_name.jar" >> "$GITHUB_OUTPUT"
40+
41+
- name: Run unit tests and build
42+
run: mvn -B --no-transfer-progress clean verify -DskipTests=false -Dmaven.test.skip=false
43+
- uses: actions/upload-artifact@v7
44+
with:
45+
name: ${{ steps.dev.outputs.name }}-${{ github.run_id }}-${{ github.run_attempt }}
46+
path: ${{ steps.dev.outputs.jar }}
47+
if-no-files-found: error
48+
49+
- name: Upload unit test reports
50+
if: ${{ !cancelled() && hashFiles('target/surefire-reports/*.xml') != '' }}
51+
uses: actions/upload-artifact@v7
52+
with:
53+
name: unit-test-reports-${{ github.run_id }}-${{ github.run_attempt }}
54+
path: target/surefire-reports/
55+
if-no-files-found: error
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Maven plugin release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
java-version:
7+
required: true
8+
type: string
9+
artifact-path:
10+
description: Exact deployable JAR path, with optional {version} placeholder
11+
required: true
12+
type: string
13+
secrets:
14+
DEPS_TOKEN:
15+
required: false
16+
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: plugin-release-${{ github.repository }}-${{ github.ref }}
22+
cancel-in-progress: false
23+
24+
defaults:
25+
run:
26+
shell: bash
27+
28+
jobs:
29+
build:
30+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
31+
runs-on: ubuntu-24.04
32+
timeout-minutes: 20
33+
steps:
34+
- uses: actions/checkout@v7
35+
with:
36+
persist-credentials: false
37+
38+
- uses: actions/setup-java@v6
39+
with:
40+
distribution: temurin
41+
java-version: ${{ inputs.java-version }}
42+
43+
- name: Validate release version
44+
env:
45+
TAG: ${{ github.ref_name }}
46+
run: |
47+
[[ "$TAG" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?(-[0-9A-Za-z]+([.-][0-9A-Za-z]+)*)?$ ]] || {
48+
echo '::error::Expected vMAJOR.MINOR or vMAJOR.MINOR.PATCH, with an optional prerelease suffix.'
49+
exit 1
50+
}
51+
[[ "${TAG^^}" != *SNAPSHOT* ]] || exit 1
52+
53+
- name: Prepare pinned dependencies
54+
env:
55+
GH_TOKEN: ${{ secrets.DEPS_TOKEN }}
56+
run: |
57+
if [[ -f .github/scripts/prepare-release.sh ]]; then
58+
bash .github/scripts/prepare-release.sh
59+
fi
60+
61+
- name: Check Maven version and build
62+
env:
63+
TAG: ${{ github.ref_name }}
64+
run: |
65+
version_file="$RUNNER_TEMP/maven-release-version"
66+
mvn -B --no-transfer-progress -P'!deploy-live' help:evaluate \
67+
-Dexpression=project.version -Doutput="$version_file"
68+
[[ "$(cat "$version_file")" == "${TAG#v}" ]] || {
69+
echo '::error::The tag must match project.version exactly.'
70+
exit 1
71+
}
72+
mvn -B --no-transfer-progress -P'!deploy-live' clean verify
73+
74+
- name: Stage only the release JAR
75+
env:
76+
ARTIFACT_PATH: ${{ inputs.artifact-path }}
77+
TAG: ${{ github.ref_name }}
78+
run: |
79+
python3 - <<'PY'
80+
import hashlib, json, os, pathlib, shutil, zipfile
81+
root = pathlib.Path.cwd().resolve()
82+
source = (root / os.environ['ARTIFACT_PATH'].replace('{version}', os.environ['TAG'][1:])).resolve()
83+
if not source.is_relative_to(root / 'target') or not source.is_file() or source.suffix != '.jar':
84+
raise SystemExit('Expected one existing JAR inside target/')
85+
with zipfile.ZipFile(source) as jar:
86+
if not {'plugin.yml', 'paper-plugin.yml'}.intersection(jar.namelist()):
87+
raise SystemExit('Release JAR has no plugin descriptor')
88+
if jar.testzip() is not None:
89+
raise SystemExit('Release JAR is corrupt')
90+
dest = pathlib.Path(os.environ['RUNNER_TEMP']) / 'plugin-release'
91+
dest.mkdir()
92+
shutil.copyfile(source, dest / source.name)
93+
digest = hashlib.sha256((dest / source.name).read_bytes()).hexdigest()
94+
(dest / 'SHA256SUMS').write_text(f'{digest} {source.name}\n')
95+
(dest / 'build.json').write_text(json.dumps({
96+
'repository': os.environ['GITHUB_REPOSITORY'],
97+
'commit': os.environ['GITHUB_SHA'],
98+
'tag': os.environ['TAG'],
99+
'run': f"{os.environ['GITHUB_SERVER_URL']}/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['GITHUB_RUN_ID']}",
100+
'artifact': source.name,
101+
'sha256': digest,
102+
}, indent=2) + '\n')
103+
PY
104+
105+
- uses: actions/upload-artifact@v7
106+
with:
107+
name: plugin-release-${{ github.sha }}
108+
path: ${{ runner.temp }}/plugin-release/
109+
if-no-files-found: error
110+
retention-days: 30
111+
112+
publish:
113+
needs: build
114+
runs-on: ubuntu-24.04
115+
timeout-minutes: 5
116+
permissions:
117+
contents: write
118+
steps:
119+
- uses: actions/download-artifact@v8
120+
with:
121+
name: plugin-release-${{ github.sha }}
122+
path: release
123+
124+
- name: Create draft release
125+
working-directory: release
126+
env:
127+
GH_TOKEN: ${{ github.token }}
128+
GH_REPO: ${{ github.repository }}
129+
TAG: ${{ github.ref_name }}
130+
run: |
131+
sha256sum --check SHA256SUMS
132+
flags=()
133+
if [[ "$TAG" == *-* ]]; then flags+=(--prerelease); fi
134+
gh release create "$TAG" ./*.jar SHA256SUMS build.json \
135+
--verify-tag --draft --title "$TAG" --generate-notes "${flags[@]}"

‎.github/workflows/release.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
release:
12+
permissions:
13+
contents: write
14+
uses: ./.github/workflows/maven-release.yml
15+
with:
16+
java-version: '25'
17+
# Exact path, not a glob. {version} is replaced with the tag without v.
18+
artifact-path: target/advancedresearch-{version}.jar
19+
secrets:
20+
DEPS_TOKEN: ${{ secrets.DEPS_TOKEN }}

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ Thumbs.db
3131

3232
# Logs
3333
*.log
34+
35+
# Downloaded build dependencies
36+
/libs/*.jar

‎pom.xml‎

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,77 +19,73 @@
1919
<artifactId>LoneLibs</artifactId>
2020
<version>3.5.0</version>
2121
<scope>system</scope>
22-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/ItemsAdder_3.5.0-r2.jar</systemPath>
22+
<systemPath>${project.basedir}/libs/ItemsAdder_3.5.0-r2.jar</systemPath>
2323
</dependency>
2424
<dependency>
2525
<groupId>local</groupId>
2626
<artifactId>json-simple</artifactId>
2727
<version>1.1</version>
2828
<scope>system</scope>
29-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/json-simple-1.1.jar</systemPath>
29+
<systemPath>${project.basedir}/libs/json-simple-1.1.jar</systemPath>
3030
</dependency>
3131
<dependency>
3232
<groupId>local</groupId>
3333
<artifactId>gson</artifactId>
3434
<version>2.10.1</version>
3535
<scope>system</scope>
36-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/gson-2.10.1.jar</systemPath>
36+
<systemPath>${project.basedir}/libs/gson-2.10.1.jar</systemPath>
3737
</dependency>
3838
<dependency>
3939
<groupId>local</groupId>
4040
<artifactId>MMOCore</artifactId>
4141
<version>1.11.3</version>
4242
<scope>system</scope>
43-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/MMOCore-1.11.3.jar</systemPath>
43+
<systemPath>${project.basedir}/libs/MMOCore-1.11.3.jar</systemPath>
4444
</dependency>
4545
<dependency>
4646
<groupId>local</groupId>
4747
<artifactId>MMOItems</artifactId>
4848
<version>6.10</version>
4949
<scope>system</scope>
50-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/MMOItems-6.10.jar</systemPath>
50+
<systemPath>${project.basedir}/libs/MMOItems-6.10.jar</systemPath>
5151
</dependency>
5252
<dependency>
5353
<groupId>local</groupId>
5454
<artifactId>MythicLib</artifactId>
5555
<version>1.6.1</version>
5656
<scope>system</scope>
57-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/MythicLib-1.7.jar</systemPath>
57+
<systemPath>${project.basedir}/libs/MythicLib-1.7.jar</systemPath>
5858
</dependency>
5959
<dependency>
6060
<groupId>local</groupId>
6161
<artifactId>spigot-api</artifactId>
6262
<version>1.20.2-R0.1-SNAPSHOT</version>
6363
<scope>system</scope>
64-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/spigot-api-1.20.2-R0.1-SNAPSHOT.jar</systemPath>
64+
<systemPath>${project.basedir}/libs/spigot-api-1.20.2-R0.1-SNAPSHOT.jar</systemPath>
6565
</dependency>
6666
<dependency>
6767
<groupId>local</groupId>
6868
<artifactId>MythicMobs</artifactId>
6969
<version>5.8.0</version>
7070
<scope>system</scope>
71-
<systemPath>D:/Dokumenter/My Plugins/Reference Libs/MythicMobs-5.8.0-SNAPSHOT.jar</systemPath>
71+
<systemPath>${project.basedir}/libs/MythicMobs-5.8.0-SNAPSHOT.jar</systemPath>
7272
</dependency>
7373
</dependencies>
7474

7575
<build>
76+
<resources>
77+
<resource>
78+
<directory>src/main/resources</directory>
79+
<filtering>true</filtering>
80+
<includes><include>plugin.yml</include></includes>
81+
</resource>
82+
<resource>
83+
<directory>src/main/resources</directory>
84+
<filtering>false</filtering>
85+
<excludes><exclude>plugin.yml</exclude></excludes>
86+
</resource>
87+
</resources>
7688
<plugins>
77-
<plugin>
78-
<groupId>org.apache.maven.plugins</groupId>
79-
<artifactId>maven-antrun-plugin</artifactId>
80-
<executions>
81-
<execution>
82-
<phase>package</phase>
83-
<goals><goal>run</goal></goals>
84-
<configuration>
85-
<target>
86-
<copy file="${project.build.directory}/${project.build.finalName}.jar"
87-
tofile="D:\Dokumenter\My Plugins\TFMC\AdvancedResearch\${project.build.finalName}.jar"/>
88-
</target>
89-
</configuration>
90-
</execution>
91-
</executions>
92-
</plugin>
9389
</plugins>
9490
</build>
9591

‎src/main/resources/plugin.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
main: me.Plugins.AdvancedResearch.ResearchMain
22
api-version: 1.19
33
name: AdvancedResearch
4-
version: 1.0
4+
version: ${project.version}
55
author: Drefvelin
66

77
depend: [MMOItems, MythicLib, ItemsAdder]

0 commit comments

Comments
 (0)