diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e76cbd9..86d6b89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,9 +102,13 @@ jobs: grep -q ":: SqlJam ::" run.log if grep -E "Exception|ERROR" run.log; then exit 1; fi + # Packages of a tag are named by it (v1.0.0-rc1: SqlJam-1.0.0-rc1-...), others by the version of pom.xml - name: Package for download shell: bash - run: sh src/packaging/package.sh ${{ matrix.platform }} + run: | + VERSION="" + case "$GITHUB_REF" in refs/tags/v*) VERSION="${GITHUB_REF_NAME#v}" ;; esac + sh src/packaging/package.sh ${{ matrix.platform }} $VERSION - uses: actions/upload-artifact@v4 if: always() @@ -130,6 +134,9 @@ jobs: - name: Create the release with the packages env: GH_TOKEN: ${{ github.token }} + # A tag with a suffix, e.g. v1.0.0-rc1 or v1.0.0-beta, is a pre-release, it is not the latest release run: | + PRERELEASE="" + case "$GITHUB_REF_NAME" in *-*) PRERELEASE="--prerelease" ;; esac gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --title "SqlJam $GITHUB_REF_NAME" \ - --generate-notes $(find artifacts -name 'SqlJam-*' -o -name 'sqljam_*.deb') + $PRERELEASE --generate-notes $(find artifacts -name 'SqlJam-*' -o -name 'sqljam_*.deb') diff --git a/src/packaging/package.sh b/src/packaging/package.sh index 2021d10..252d30e 100755 --- a/src/packaging/package.sh +++ b/src/packaging/package.sh @@ -5,6 +5,8 @@ # # sh src/packaging/package.sh [version] platform: mac-aarch64, mac, win or linux # +# The version names the packages, e.g. 1.0.0-rc1 of the tag v1.0.0-rc1; the version of pom.xml by default. +# # mac-aarch64, mac SqlJam.app in SqlJam--.dmg # win SqlJam--win.zip, SqlJam\SqlJam.exe without installing # linux SqlJam--linux.tar.gz (SqlJam/bin/SqlJam) and sqljam__amd64.deb @@ -18,8 +20,10 @@ set -e PLATFORM=${1:?platform: mac-aarch64, mac, win or linux} DIR=$(cd "$(dirname "$0")/../.." && pwd) -VERSION=${2:-$(sed -n 's:^ \(.*\):\1:p' "$DIR/pom.xml" | head -1)} -JAR="sqljam-$VERSION-$PLATFORM.jar" +# The runnable jar is named by the version of pom.xml, the packages by the given version +POM_VERSION=$(sed -n 's:^ \(.*\):\1:p' "$DIR/pom.xml" | head -1) +VERSION=${2:-$POM_VERSION} +JAR="sqljam-$POM_VERSION-$PLATFORM.jar" # jpackage takes numbers only, e.g. 1.0.0 of 1.0.0-SNAPSHOT APP_VERSION=$(echo "$VERSION" | sed 's/[^0-9.].*$//') WORK="$DIR/target/package-$PLATFORM"