Skip to content

JMPQ3 2.0.0: Java 25 core and performance #2

JMPQ3 2.0.0: Java 25 core and performance

JMPQ3 2.0.0: Java 25 core and performance #2

Workflow file for this run

# Publishes a tagged commit to GitHub Packages and opens the GitHub Release.
#
# Triggered by pushing a tag, so releasing is `git tag v2.0.0 && git push --tags`
# rather than a sequence of clicks. The previous workflow ran on a release being
# created by hand -- and published nothing, because the build had no publishing
# repository configured, so `./gradlew publish` had no task to run.
name: Release
on:
push:
tags: [ 'v*' ]
workflow_dispatch:
inputs:
version:
description: 'Version to publish, without the leading v (e.g. 2.0.0)'
required: true
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # create the release
packages: write # publish the artifact
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '25'
- uses: gradle/actions/setup-gradle@v6
- uses: actions/setup-python@v6
with:
python-version: '3.x'
# The tag is the single source of truth for the version, so the artifact
# cannot disagree with what it is tagged as.
- name: Resolve the version
id: version
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${GITHUB_REF_NAME#v}"
fi
if ! printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$'; then
echo "::error::'$VERSION' is not a semantic version; tag as vMAJOR.MINOR.PATCH"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Releasing $VERSION"
# A release runs the same gate as a pull request. Publishing something the
# independent reference never checked would defeat the point of having it.
- name: Build and test
run: ./gradlew build -PreleaseVersion=${{ steps.version.outputs.version }}
- name: Verify archives with the reference implementation
run: |
python tools/mpqref.py selftest
python tools/mpqref.py verify build/roundtrip/archives --manifest build/roundtrip/expected.tsv
python tools/mpqref.py verify build/roundtrip-newcore/archives --manifest build/roundtrip-newcore/expected.tsv
python tools/mpqref.py verify build/stored-encrypted/archives --manifest build/stored-encrypted/expected.tsv
python tools/mpqref.py verify build/phase2/archives --manifest build/phase2/expected.tsv
- name: Check the golden manifest is up to date
run: |
python tools/mpqref.py manifest src/test/resources/mpqs \
--names src/test/resources/DefaultListfile.txt \
-o /tmp/fixtures.tsv
diff -u src/test/resources/golden/fixtures.tsv /tmp/fixtures.tsv
- name: Publish to GitHub Packages
run: ./gradlew publish -PreleaseVersion=${{ steps.version.outputs.version }}
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create the GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
if gh release view "v$VERSION" >/dev/null 2>&1; then
gh release upload "v$VERSION" build/libs/*.jar --clobber
else
gh release create "v$VERSION" build/libs/*.jar \
--title "JMPQ3 $VERSION" \
--generate-notes
fi