blob: 21a80680d5939f78e1dafc1c1d7c82383e740ef7 [file] [log] [blame]
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Build with Gradle
run: ./gradlew build --no-daemon
- name: Get version and pre-release status
id: get_version
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
if [[ "$TAG_NAME" =~ (alpha|beta|rc) ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Extract release notes from CHANGELOG.md
id: changelog
run: |
TAG_NAME="${{ steps.get_version.outputs.tag_name }}"
# Pull the section for this version: everything between the
# "## [<tag>]" heading and the next "## [" heading. We author the
# changelog by hand (Gerrit workflow, no PRs to mine for notes).
NOTES=$(awk -v tag="$TAG_NAME" '
$0 ~ "^## \\[" tag "\\]" { flag=1; next }
/^## \[/ { flag=0 }
flag { print }
' CHANGELOG.md)
if [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then
echo "No CHANGELOG.md section found for $TAG_NAME; falling back to a generic body." >&2
NOTES="Release $TAG_NAME"
fi
{
echo "notes<<__CHANGELOG_EOF__"
echo "$NOTES"
echo "__CHANGELOG_EOF__"
} >> "$GITHUB_OUTPUT"
- name: Create Release
uses: softprops/action-gh-release@v3
with:
body: ${{ steps.changelog.outputs.notes }}
tag_name: ${{ steps.get_version.outputs.tag_name }}
name: Release ${{ steps.get_version.outputs.tag_name }}
prerelease: ${{ steps.get_version.outputs.prerelease }}
files: |
app/build/libs/*.jar
build/bin/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}