ci: switch release workflow to Linux cross-compilation (#50)
* ci: cross-compile release assets on Linux * ci: use OS runners and Linux-only cross-arch builds * ci: sanitize non-release artifact version tags
This commit is contained in:
parent
e92b8b970c
commit
1e2852eac4
|
|
@ -4,13 +4,16 @@ on:
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/release.yaml
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.target_os }}-${{ matrix.arch }}
|
name: Build ${{ matrix.target_os }}-${{ matrix.target_arch }}
|
||||||
runs-on: ${{ matrix.runs_on }}
|
runs-on: ${{ matrix.runs_on }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
@ -18,19 +21,19 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- runs_on: ubuntu-24.04
|
- runs_on: ubuntu-24.04
|
||||||
target_os: linux
|
target_os: linux
|
||||||
arch: x64
|
target_arch: x64
|
||||||
ext: ''
|
ext: ''
|
||||||
- runs_on: ubuntu-24.04-arm
|
- runs_on: ubuntu-24.04
|
||||||
target_os: linux
|
target_os: linux
|
||||||
arch: arm64
|
target_arch: arm64
|
||||||
ext: ''
|
ext: ''
|
||||||
- runs_on: macos-14
|
- runs_on: macos-14
|
||||||
target_os: macos
|
target_os: macos
|
||||||
arch: arm64
|
target_arch: arm64
|
||||||
ext: ''
|
ext: ''
|
||||||
- runs_on: windows-2022
|
- runs_on: windows-2022
|
||||||
target_os: windows
|
target_os: windows
|
||||||
arch: x64
|
target_arch: x64
|
||||||
ext: .exe
|
ext: .exe
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -45,26 +48,41 @@ jobs:
|
||||||
run: dart run build_runner build --delete-conflicting-outputs
|
run: dart run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
- name: Build executable
|
- name: Build executable
|
||||||
run: dart compile exe bin/code_work_spawner.dart -o dist/code_work_spawner${{ matrix.ext }}
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
if [[ "${{ matrix.target_os }}" == "linux" ]]; then
|
||||||
|
dart compile exe bin/code_work_spawner.dart --target-os=linux --target-arch=${{ matrix.target_arch }} -o dist/code_work_spawner${{ matrix.ext }}
|
||||||
|
else
|
||||||
|
dart compile exe bin/code_work_spawner.dart -o dist/code_work_spawner${{ matrix.ext }}
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Prepare release asset
|
- name: Prepare release asset
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p release-assets
|
mkdir -p release-assets
|
||||||
asset_name="code_work_spawner-${{ github.ref_name }}-${{ matrix.target_os }}-${{ matrix.arch }}${{ matrix.ext }}"
|
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
|
||||||
|
version_tag="${GITHUB_REF_NAME}"
|
||||||
|
else
|
||||||
|
version_tag="${GITHUB_REF_NAME//\//-}"
|
||||||
|
fi
|
||||||
|
asset_name="code_work_spawner-${version_tag}-${{ matrix.target_os }}-${{ matrix.target_arch }}${{ matrix.ext }}"
|
||||||
cp "dist/code_work_spawner${{ matrix.ext }}" "release-assets/${asset_name}"
|
cp "dist/code_work_spawner${{ matrix.ext }}" "release-assets/${asset_name}"
|
||||||
|
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: code_work_spawner-${{ matrix.target_os }}-${{ matrix.arch }}
|
name: code_work_spawner-${{ matrix.target_os }}-${{ matrix.target_arch }}
|
||||||
path: release-assets/*
|
path: release-assets/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Upload release assets
|
name: Upload release assets
|
||||||
|
if: github.event_name == 'release'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Download build artifacts
|
- name: Download build artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue