Skip to content

Commit 9a59e44

Browse files
Add GitHub Actions workflow for build and release
Introduces a workflow that builds a shaded JAR on pushes to main, computes a version based on the current UTC date and time, and creates a GitHub release with the generated artifact.
1 parent e7874e1 commit 9a59e44

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build & Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Java
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: temurin
23+
java-version: "25"
24+
cache: gradle
25+
26+
- name: Compute version/tag
27+
id: ver
28+
shell: bash
29+
run: |
30+
VERSION="$(date -u +%Y.%m.%d.%H%M)"
31+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
32+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
33+
34+
- name: Build (shaded jar)
35+
shell: bash
36+
env:
37+
VERSION_OVERRIDE: ${{ steps.ver.outputs.version }}
38+
run: |
39+
chmod +x ./gradlew
40+
./gradlew build -x test
41+
42+
- name: Locate shaded jar
43+
id: jar
44+
shell: bash
45+
run: |
46+
JAR="$(ls -1 build/libs/*-shaded.jar | head -n 1)"
47+
if [ -z "$JAR" ]; then
48+
echo "No shaded jar found in build/libs"
49+
ls -la build/libs || true
50+
exit 1
51+
fi
52+
echo "path=$JAR" >> "$GITHUB_OUTPUT"
53+
54+
- name: Create GitHub Release
55+
uses: softprops/action-gh-release@v2
56+
with:
57+
tag_name: ${{ steps.ver.outputs.tag }}
58+
name: Release ${{ steps.ver.outputs.tag }}
59+
generate_release_notes: true
60+
files: |
61+
${{ steps.jar.outputs.path }}
62+

0 commit comments

Comments
 (0)