build: native image workflow #3
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: Release Binary | |
on: | |
push: | |
tags: | |
- 'com.kepler16/kmono@*' | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, macos-latest-xlarge] | |
include: | |
- os: ubuntu-latest | |
binary-name: kmono-linux-amd64 | |
- os: macos-latest | |
binary-name: kmono-macos-amd64 | |
- os: macos-latest-xlarge | |
binary-name: kmono-macos-arm64 | |
env: | |
GITHUB_USERNAME: ${{ secrets.ORG_GITHUB_ACTOR }} | |
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fetch Tags | |
run: git fetch --tags origin | |
- uses: extractions/setup-just@v1 | |
- uses: DeLaGuardo/[email protected] | |
with: | |
cli: latest | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '21' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: s4u/[email protected] | |
with: | |
githubServer: false | |
servers: | | |
[{"id": "github-kepler", | |
"username": "${{ secrets.ORG_GITHUB_ACTOR }}", | |
"password": "${{ secrets.ORG_GITHUB_TOKEN }}"}, | |
{"id": "github-kepler-kmono", | |
"username": "${{ github.actor }}", | |
"password": "${{ secrets.GITHUB_TOKEN }}"}] | |
- name: Build Uber for Native Image | |
run: just build-uber ":snapshot?" false | |
- name: Build Native Image | |
run: just build-native ":snapshot?" false | |
- name: Pack binary | |
run: | | |
tar -czf ${{ matrix.binary-name }}.tar.gz -C ./bin kmono | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: kmono-native-images | |
if-no-files-found: error | |
path: ${{ matrix.binary-name }}.tar.gz | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'com.kepler16/kmono@') }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Binary Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: kmono-native-images | |
path: bin | |
- name: Calculate checksums | |
run: | | |
for file in bin/*; do | |
shasum -a 256 "$file" >> checksums.txt | |
done | |
mv checksums.txt bin/checksums.txt | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
bin/* |