89 lines
3.0 KiB
YAML
89 lines
3.0 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Create Release
|
|
uses: actions/create-release@latest
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
with:
|
|
tag_name: ${{ gitea.ref }}
|
|
release_name: "${{ gitea.event.repository.name }} ${{ gitea.ref_name }}"
|
|
draft: true
|
|
prerelease: false
|
|
publish:
|
|
name: publish
|
|
needs:
|
|
- release
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
include:
|
|
- suffix: windows-x86_64
|
|
platform: windows-2022
|
|
archive: zip
|
|
name: x86_64-pc-windows-msvc
|
|
# - suffix: linux-x86_64
|
|
# platform: ubuntu-latest
|
|
# archive: tar.gz
|
|
# name: x86_64-unknown-linux-gnu
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Dump context
|
|
run: |
|
|
echo "$env:GITEA_CONTEXT"
|
|
env:
|
|
GITEA_CONTEXT: ${{ toJson(gitea) }}
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Install alsa and udev
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev
|
|
- name: Setup Rust toolchain and cach
|
|
if: matrix.platform != 'windows-2022'
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
- name: Ensure rust is up to date
|
|
if: matrix.platform == 'windows-2022'
|
|
run: |
|
|
rustup update
|
|
rustup toolchain install nightly
|
|
- name: Create output directory for windows
|
|
if: matrix.platform == 'windows-2022'
|
|
run: mkdir -f output
|
|
- name: Create output directory for linux
|
|
if: matrix.platform != 'windows-2022'
|
|
run: mkdir output
|
|
- name: Build release
|
|
run: cargo +nightly -Z unstable-options b -r --artifact-dir ./output
|
|
- name: Collect windows artifacts
|
|
if: matrix.platform == 'windows-2022'
|
|
run: |
|
|
cp -r -fo assets $env:GITHUB_WORKSPACE/output/
|
|
Compress-Archive -Force -Path $env:GITHUB_WORKSPACE/output/* -DestinationPath $env:GITHUB_WORKSPACE/${{ gitea.event.repository.name }}-${{ gitea.ref_name }}-${{ matrix.name }}.${{ matrix.archive }}
|
|
- name: Collect linux/macos artifacts
|
|
if: matrix.platform != 'windows-2022'
|
|
run: |
|
|
cp -rf assets ${GITHUB_WORKSPACE}/output/
|
|
tar -czvf ${GITHUB_WORKSPACE}/${{ gitea.event.repository.name }}-${{ gitea.ref_name }}-${{ matrix.name }}.${{ matrix.archive }} -C ${GITHUB_WORKSPACE}/output/ .
|
|
- name: Upload artifacts
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
draft: false
|
|
name: "${{ gitea.event.repository.name }} ${{ gitea.ref_name }}"
|
|
files: "${{ gitea.event.repository.name }}-${{ gitea.ref_name }}-${{ matrix.name }}.${{ matrix.archive }}"
|