Native Images v1.2025.0 by @ggrossetie #71
This file contains 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: Native Images On-Demand | |
run-name: Native Images ${{ inputs.tag }} by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
required: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build_artifacts: | |
outputs: | |
release_version: ${{ steps.version.outputs.release_version }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set release version | |
id: version | |
env: | |
REF: ${{ github.event.inputs.tag }} | |
run: | | |
echo "release_version=${REF#v}" >> $GITHUB_ENV | |
echo "release_version=${REF#v}" >> $GITHUB_OUTPUT | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
with: | |
ref: "refs/tags/${{ github.event.inputs.tag }}" | |
- name: Set up java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: temurin | |
cache: gradle | |
- name: Set version from tag | |
env: | |
RELEASE_VERSION: ${{ env.release_version }} | |
run: sed -i "s/version = .*/version = $RELEASE_VERSION/" gradle.properties | |
- name: Build artifacts | |
run: | | |
gradle -q clean build \ | |
pdfJar \ | |
-x test | |
- name: Cache libs | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
build/libs | |
build/publications | |
plantuml-asl/build/libs | |
plantuml-bsd/build/libs | |
plantuml-epl/build/libs | |
plantuml-lgpl/build/libs | |
plantuml-mit/build/libs | |
plantuml-gplv2/build/libs | |
key: "libs-${{ github.run_id }}" | |
enableCrossOsArchive: true | |
native_images: | |
needs: build_artifacts | |
uses: ./.github/workflows/native-image.yml | |
with: | |
release-version: ${{ needs.build_artifacts.outputs.release_version }} | |
upload: | |
needs: [ build_artifacts, native_images ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Restore Libs cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
build/libs | |
build/publications | |
plantuml-asl/build/libs | |
plantuml-bsd/build/libs | |
plantuml-epl/build/libs | |
plantuml-lgpl/build/libs | |
plantuml-mit/build/libs | |
plantuml-gplv2/build/libs | |
key: "libs-${{ github.run_id }}" | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Restore Native-image-win-amd64 cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: "build/libs/plantuml-win-amd64/*" | |
key: "native-image-win-amd64-${{ github.run_id }}" | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Restore Native-image-linux-amd64 cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: "build/libs/plantuml-linux-amd64/*" | |
key: "native-image-linux-amd64-${{ github.run_id }}" | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Restore Native-image-linux-arm64 cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: "build/libs/plantuml-linux-arm64/*" | |
key: "native-image-linux-arm64-${{ github.run_id }}" | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Restore Native-image-darwin-arm64 cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: "build/libs/plantuml-darwin-arm64/*" | |
key: "native-image-darwin-arm64-${{ github.run_id }}" | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Zip files | |
run: | | |
zip -r -j "plantuml-linux-arm64-$RELEASE_VERSION.zip" build/libs/plantuml-linux-arm64/* | |
zip -r -j "plantuml-linux-amd64-$RELEASE_VERSION.zip" build/libs/plantuml-linux-amd64/* | |
zip -r -j "plantuml-win-amd64-$RELEASE_VERSION.zip" build/libs/plantuml-win-amd64/* | |
zip -r -j "plantuml-darwin-arm64-$RELEASE_VERSION.zip" build/libs/plantuml-darwin-arm64/* | |
env: | |
RELEASE_VERSION: ${{ needs.build_artifacts.outputs.release_version }} | |
- name: Create release | |
run: | | |
gh release view "v$RELEASE_VERSION" || gh release create "v$RELEASE_VERSION" | |
gh release upload "v$RELEASE_VERSION" plantuml-linux-*.zip plantuml-win-*.zip plantuml-darwin-*.zip --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_VERSION: ${{ needs.build_artifacts.outputs.release_version }} |