rewrite #91
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
on: push | |
jobs: | |
build-and-upload: | |
name: Build and Upload | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
artifact-name: sup-linux-amd | |
- os: macos-latest | |
artifact-name: sup-macos-amd | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Scala | |
uses: olafurpg/setup-scala@v14 | |
with: | |
java-version: [email protected] | |
- name: Test for ${{ matrix.os }} | |
run: sbt test | |
- name: Setup GraalVM (for tagged commits) | |
uses: graalvm/setup-graalvm@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
java-version: "21" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Native Image (for tagged commits) | |
run: sbt nativeImage | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Compress using UPX (not on Windows) | |
uses: svenstaro/upx-action@v2 | |
if: startsWith(github.ref, 'refs/tags/') && matrix.os != 'windows-latest' | |
with: | |
file: target/native-image/scala-update | |
args: --best --lzma | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: target/native-image/scala-update | |
- name: Release Binaries | |
uses: svenstaro/upload-release-action@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/native-image/scala-update | |
asset_name: ${{ matrix.artifact-name }} | |
overwrite: true | |
tag: ${{ github.ref }} | |
- name: Prepare Homebrew Formula Update (macOS only) | |
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-latest' | |
run: | | |
brew tap kitlangton/tap | |
version=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') | |
brew bump-formula-pr kitlangton/tap/scala-update --no-browse --no-audit \ | |
--url="https://github.com/kitlangton/scala-update/releases/download/${version}/${{ matrix.artifact-name }}" | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} |