Skip to content

Update README.md

Update README.md #2

Workflow file for this run

name: Build and Release an SDK Generator
on:
push:
branches:
- main
env:
FILE_NAME: aidbox-sdk
jobs:
build-jar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- name: Setup Clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: latest
- name: Cache clojure dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
key: cljdeps-${{ hashFiles('deps.edn') }}
restore-keys: cljdeps-
- name: Build uberjar
run: |
clojure -T:build uberjar :jar-name ${{ env.FILE_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Move jar into release directory
run: |
mkdir -p release
mv target/${{ env.FILE_NAME }}.jar release/${{ env.FILE_NAME }}.jar
- name: Upload jar artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILE_NAME }}.jar
path: release/${{ env.FILE_NAME }}.jar
build-amd64:
runs-on: ubuntu-latest
needs: build-jar
steps:
- name: Download jar artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}.jar
path: release/
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GH_TOKEN }}
native-image-job-reports: 'true'
- name: Compile to native binary
run: |
native-image -jar release/${{ env.FILE_NAME }}.jar --no-fallback --no-server ${{ env.FILE_NAME }}
mv ${{ env.FILE_NAME }} release/${{ env.FILE_NAME }}
- name: Upload amd64 binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILE_NAME }}-amd64
path: release/${{ env.FILE_NAME }}
build-arm64:
runs-on: macos-latest
needs: build-jar
steps:
- name: Download jar artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}.jar
path: release/
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GH_TOKEN }}
native-image-job-reports: 'true'
- name: Compile to native binary
run: |
native-image -jar release/${{ env.FILE_NAME }}.jar --no-fallback --no-server ${{ env.FILE_NAME }}
mv ${{ env.FILE_NAME }} release/${{ env.FILE_NAME }}-arm64
- name: Upload arm64 binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILE_NAME }}-arm64
path: release/${{ env.FILE_NAME }}-arm64
build-windows:
runs-on: windows-latest
needs: build-jar
steps:
- name: Download jar artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}.jar
path: release/
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GH_TOKEN }}
native-image-job-reports: 'true'
- name: Compile to native binary
run: |
native-image -jar release/${{ env.FILE_NAME }}.jar --no-fallback --no-server ${{ env.FILE_NAME }}
mv ${{ env.FILE_NAME }}.exe release/${{ env.FILE_NAME }}.exe
- name: Upload arm64 binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILE_NAME }}.exe
path: release/${{ env.FILE_NAME }}.exe
create-release:
runs-on: ubuntu-latest
needs: [build-jar, build-amd64, build-arm64, build-windows]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download jar artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}.jar
path: release/
- name: Download linux-amd64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}-amd64
path: release/
- name: Download arm64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}-arm64
path: release/
- name: Download windows artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.FILE_NAME }}.exe
path: release/
- name: Fetch all tags
run: git fetch --tags
- name: Determine next version
id: next_version
run: |
# Get the latest tag
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $latest_tag"
if [ -z "$latest_tag" ]; then
next_version="v1"
else
# Parse the version number
IFS='.' read -r -a version_parts <<< "${latest_tag:1}"
major=${version_parts[0]}
minor=${version_parts[1]}
patch=${version_parts[2]}
# Increment the patch version
patch=$((patch + 1))
next_version="v$major.$minor.$patch"
fi
echo "Next version: $next_version"
echo "tag=$next_version" >> $GITHUB_OUTPUT
- name: Create a new tag
run: |
git tag ${{ steps.next_version.outputs.tag }}
git push origin ${{ steps.next_version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.next_version.outputs.tag }}
release_name: Release ${{ steps.next_version.outputs.tag }}
draft: false
prerelease: false
- name: Upload Release Asset (jar)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release/${{ env.FILE_NAME }}.jar
asset_name: ${{ env.FILE_NAME }}.jar
asset_content_type: application/java-archive
- name: Upload Release Asset (amd64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release/${{ env.FILE_NAME }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/octet-stream
- name: Upload Release Asset (arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release/${{ env.FILE_NAME }}-arm64
asset_name: ${{ env.FILE_NAME }}-arm64
asset_content_type: application/octet-stream
- name: Upload Release Assets (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release/${{ env.FILE_NAME }}.exe
asset_name: ${{ env.FILE_NAME }}.exe
asset_content_type: application/octet-stream