code_work_spawner/.github/workflows/release.yaml

81 lines
2.0 KiB
YAML

name: release
on:
release:
types:
- published
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target_os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- runs_on: ubuntu-24.04
target_os: linux
arch: x64
ext: ''
- runs_on: ubuntu-24.04-arm
target_os: linux
arch: arm64
ext: ''
- runs_on: macos-14
target_os: macos
arch: arm64
ext: ''
- runs_on: windows-2022
target_os: windows
arch: x64
ext: .exe
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: dart pub get
- name: Build executable
run: dart compile exe bin/code_work_spawner.dart -o dist/code_work_spawner${{ matrix.ext }}
- name: Prepare release asset
shell: bash
run: |
mkdir -p release-assets
asset_name="code_work_spawner-${{ github.ref_name }}-${{ matrix.target_os }}-${{ matrix.arch }}${{ matrix.ext }}"
cp "dist/code_work_spawner${{ matrix.ext }}" "release-assets/${asset_name}"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: code_work_spawner-${{ matrix.target_os }}-${{ matrix.arch }}
path: release-assets/*
if-no-files-found: error
publish:
name: Upload release assets
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Generate checksums
run: |
cd release-assets
sha256sum * > SHA256SUMS.txt
- name: Upload assets to release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.ref_name }}" release-assets/* --clobber