fix title 2 #129
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - 'hortonmachine-*' # any tag starting with v, e.g. v0.10.11 | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ---- SNAPSHOT BUILD ---- | |
| snapshot: | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'maven' | |
| server-id: ossrh | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Run Tests | |
| run: mvn -U clean verify | |
| - name: Build and Deploy Snapshot | |
| run: mvn -U deploy -DskipTests=true -P release -Dmaven.javadoc.skip=true -Dgpg.skip=false | |
| env: | |
| MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
| MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| # ---- RELEASE BUNDLE ---- | |
| release-bundle: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'maven' | |
| - name: Resolve project version | |
| id: ver | |
| run: echo "VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> "$GITHUB_OUTPUT" | |
| - name: Build project (skip tests + javadoc) | |
| run: mvn -U clean install -DskipTests -Dmaven.javadoc.skip=true | |
| # --- keep this step (populate) as-is --- | |
| - name: Populate libs from hm-apps deps | |
| run: | | |
| set -euxo pipefail | |
| TMPLIBS=./extras/export/libs | |
| mkdir -p "${TMPLIBS}" | |
| # Copy hm-apps runtime deps | |
| mvn -q -pl :hm-apps -am dependency:copy-dependencies \ | |
| -DoutputDirectory="${TMPLIBS}" \ | |
| -DincludeScope=runtime \ | |
| -DexcludeClassifiers=sources,javadoc | |
| # Copy the app jar itself (no sources jar) | |
| cp ./apps/target/hm-apps-*.jar "${TMPLIBS}" | |
| rm -f "${TMPLIBS}"/*-sources.jar || true | |
| rm -f "${TMPLIBS}"/junit*.jar "${TMPLIBS}"/log4j-*.jar || true | |
| # --- FIXED assemble step --- | |
| - name: Assemble tar.gz bundle | |
| run: | | |
| set -euxo pipefail | |
| VERSION="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" | |
| TMPLIBS="./extras/export/libs" | |
| DEPLOY="./extras/deploy" | |
| RELEASE_DIR="${DEPLOY}/hortonmachine_${VERSION}" | |
| # Download fixed Temurin JRE 17 (Windows x64) | |
| JRE_URL="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jre_x64_windows_hotspot_17.0.16_8.zip" | |
| echo "Downloading Temurin JRE from: ${JRE_URL}" | |
| curl -fsSL -o ./temurin-jre-win.zip "${JRE_URL}" | |
| # Unzip and normalize folder name to ./jre | |
| unzip -q ./temurin-jre-win.zip -d . | |
| mv jdk-17.0.16+8-jre jre | |
| rm -f ./temurin-jre-win.zip | |
| # Prep release dir (don't delete ${TMPLIBS}) | |
| rm -rf "${DEPLOY}/libs" "${RELEASE_DIR}" "${DEPLOY}/hortonmachine_${VERSION}.tar.gz" | |
| mkdir -p "${RELEASE_DIR}" | |
| # Move populated libs into the release dir | |
| mv "${TMPLIBS}" "${RELEASE_DIR}/libs" | |
| # Copy deploy assets (allow missing patterns without failing) | |
| shopt -s nullglob | |
| cp -rv ${DEPLOY}/*.sh ${DEPLOY}/*.exe ${DEPLOY}/*.bat "${RELEASE_DIR}" || true | |
| cp -rv ${DEPLOY}/imgs ${DEPLOY}/natives ${DEPLOY}/quiet-logging.properties "${RELEASE_DIR}" || true | |
| shopt -u nullglob | |
| # ➜ Put JRE inside the release dir so it's included in the tarball | |
| mv ./jre "${RELEASE_DIR}/jre" | |
| # Create tarball | |
| tar -C "${DEPLOY}" -zcvf "${DEPLOY}/hortonmachine_${VERSION}.tar.gz" "hortonmachine_${VERSION}" | |
| # Optional: keep a copy of libs next to the tarball (and clean temp dir) | |
| mv "${RELEASE_DIR}/libs" "${DEPLOY}/" | |
| rm -rf "${RELEASE_DIR}" | |
| - name: Build release title | |
| id: rel | |
| run: | | |
| VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version) | |
| DATE=$(date +'%Y-%m-%d %H%M') | |
| echo "TITLE=Hortonmachine-${VERSION} - release ${DATE}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} # the tag that triggered the workflow | |
| name: ${{ steps.rel.outputs.TITLE }} | |
| body: | | |
| SNAPSHOT Release ${{ steps.ver.outputs.VERSION }} of the hortonmachine libs, | |
| run-ready for Windows users (Java + SpatiaLite libs). | |
| Linux and macOS users will know what to do. | |
| files: extras/deploy/hortonmachine_${{ steps.ver.outputs.VERSION }}.tar.gz | |
| - name: Attach bundle to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: extras/deploy/hortonmachine_${{ steps.ver.outputs.VERSION }}.tar.gz | |