blob: 2b659ceba9507a66a1d8581b0af46958be6d9658 [file] [log] [blame]
Marc Kupietz2ec7f9f2025-11-21 11:24:14 +01001name: Release
2
3on:
4 push:
5 tags:
6 - 'v*'
7
8jobs:
9 release:
10 runs-on: ubuntu-latest
11 steps:
dependabot[bot]f170b4d2026-06-22 08:53:59 +000012 - uses: actions/checkout@v7
Marc Kupietz2ec7f9f2025-11-21 11:24:14 +010013 - name: Set up JDK 21
dependabot[bot]9313c4e2025-11-21 10:56:36 +000014 uses: actions/setup-java@v5
Marc Kupietz2ec7f9f2025-11-21 11:24:14 +010015 with:
16 distribution: 'temurin'
17 java-version: '21'
18 - name: Build with Gradle
19 run: ./gradlew build --no-daemon
20 - name: Get version and pre-release status
21 id: get_version
22 run: |
23 TAG_NAME=${GITHUB_REF#refs/tags/}
24 echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
25 if [[ "$TAG_NAME" =~ (alpha|beta|rc) ]]; then
26 echo "prerelease=true" >> $GITHUB_OUTPUT
27 else
28 echo "prerelease=false" >> $GITHUB_OUTPUT
29 fi
Marc Kupietz8c784fe2026-06-08 08:48:32 +020030 - name: Extract release notes from CHANGELOG.md
31 id: changelog
32 run: |
33 TAG_NAME="${{ steps.get_version.outputs.tag_name }}"
34 # Pull the section for this version: everything between the
35 # "## [<tag>]" heading and the next "## [" heading. We author the
36 # changelog by hand (Gerrit workflow, no PRs to mine for notes).
37 NOTES=$(awk -v tag="$TAG_NAME" '
38 $0 ~ "^## \\[" tag "\\]" { flag=1; next }
39 /^## \[/ { flag=0 }
40 flag { print }
41 ' CHANGELOG.md)
42 if [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then
43 echo "No CHANGELOG.md section found for $TAG_NAME; falling back to a generic body." >&2
44 NOTES="Release $TAG_NAME"
45 fi
46 {
47 echo "notes<<__CHANGELOG_EOF__"
48 echo "$NOTES"
49 echo "__CHANGELOG_EOF__"
50 } >> "$GITHUB_OUTPUT"
Marc Kupietz3886dee2025-11-22 12:49:49 +010051
Marc Kupietz2ec7f9f2025-11-21 11:24:14 +010052 - name: Create Release
dependabot[bot]8d359382026-04-13 09:09:21 +000053 uses: softprops/action-gh-release@v3
Marc Kupietz2ec7f9f2025-11-21 11:24:14 +010054 with:
Marc Kupietz8c784fe2026-06-08 08:48:32 +020055 body: ${{ steps.changelog.outputs.notes }}
Marc Kupietz2ec7f9f2025-11-21 11:24:14 +010056 tag_name: ${{ steps.get_version.outputs.tag_name }}
57 name: Release ${{ steps.get_version.outputs.tag_name }}
58 prerelease: ${{ steps.get_version.outputs.prerelease }}
59 files: |
60 app/build/libs/*.jar
61 build/bin/*
62 env:
63 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}