build: fix workflow to include resources #36
Workflow file for this run
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: Build and Release Tahini Binaries | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
version: 'latest' | |
java-version: '21' | |
- name: Build jar with Gradle | |
run: | | |
cd tahini | |
./gradlew build | |
- name: Compile native image on Linux/macOS | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd tahini | |
native-image \ | |
-H:IncludeResources="larder/.*" \ | |
-jar app/build/libs/app.jar | |
- name: Compile native image on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd tahini | |
native-image ` | |
-H:IncludeResources="larder/.*" ` | |
-jar app/build/libs/app.jar | |
- name: Rename binary for unique names on Macos and Linux | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd tahini | |
VERSION=${{ github.ref_name }} | |
SAFEVERSION=${VERSION//./-} | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
mv tahini tahini-linux-${SAFEVERSION} | |
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
mv tahini tahini-macos-${SAFEVERSION} | |
fi | |
- name: Rename binary for unique names on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd tahini | |
$VERSION = "${{ github.ref_name }}" | |
$SAFEVERSION = $VERSION -replace '\.', '-' | |
Rename-Item -Path "tahini.exe" -NewName "tahini-windows-$SAFEVERSION.exe" | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tahini-${{ matrix.os }} | |
path: tahini | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
- name: Set Version Variable | |
id: set_version | |
run: | | |
# Replace dots with hyphens in the version name | |
VERSION="${{ github.ref_name }}" | |
VERSION=${VERSION//./-} | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
prerelease: ${{ contains(github.ref, 'beta') }} | |
files: | | |
tahini-ubuntu-latest/tahini-linux-${{ env.VERSION }} | |
tahini-macos-latest/tahini-macos-${{ env.VERSION }} | |
tahini-windows-latest/tahini-windows-${{ env.VERSION }}.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} |