try to add bundle build #111
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 | ||
| 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 | ||
| - name: Assemble tar.gz bundle | ||
| run: | | ||
| set -euxo pipefail | ||
| VERSION="${{ steps.ver.outputs.VERSION }}" | ||
| TMPLIBS="./extras/export/libs" | ||
| DEPLOY="./extras/deploy" | ||
| RELEASE_DIR="${DEPLOY}/hortonmachine_${VERSION}" | ||
| rm -rf "${TMPLIBS}" "${DEPLOY}/libs" "${RELEASE_DIR}" "${DEPLOY}/hortonmachine_${VERSION}.tar.gz" | ||
| mkdir -p "${RELEASE_DIR}" | ||
| cp ./apps/target/hm-apps-*.jar "${TMPLIBS}" | ||
| rm -f ${TMPLIBS}/junit*.jar || true | ||
| rm -f ${TMPLIBS}/log4j-*.jar || true | ||
| rm -f ${TMPLIBS}/*-sources.jar || true | ||
| mv "${TMPLIBS}" "${RELEASE_DIR}/libs" | ||
| cp -rv ${DEPLOY}/*.sh ${DEPLOY}/*.exe ${DEPLOY}/*.bat ${DEPLOY}/imgs ${DEPLOY}/natives ${DEPLOY}/quiet-logging.properties "${RELEASE_DIR}" | ||
| tar -C "${DEPLOY}" -zcvf "${DEPLOY}/hortonmachine_${VERSION}.tar.gz" "hortonmachine_${VERSION}" | ||
| - name: Upload bundle artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: hortonmachine-${{ steps.ver.outputs.VERSION }}-bundle | ||
| path: 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 | ||