Files
spotify-quickauth/.github/workflows/build.yaml

118 lines
3.4 KiB
YAML

name: Build
permissions:
contents: write
on:
workflow_dispatch:
inputs:
fail_fast:
description: 'Fail fast strategy'
required: false
default: 'true'
push:
tags:
- 'v*.*.*'
paths-ignore:
- README.md
- .gitignore
- LICENSE
- run.sh
pull_request:
paths-ignore:
- README.md
- .gitignore
- LICENSE
- run.sh
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: ${{ startsWith(github.ref, 'refs/tags/') || github.event.inputs.fail_fast == 'true' }}
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
linker: gcc-aarch64-linux-gnu
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
linker: gcc-arm-linux-gnueabihf
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
runs-on: ${{ matrix.os }}
name: release-${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install Linker
if: matrix.linker
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.linker }}
# ensure has a newline at the end
[ "$(tail -c 1 .cargo/config.toml)" != "" ] && echo >> .cargo/config.toml
cat .cargo/config.github.toml >> .cargo/config.toml
- name: Build
run: cargo build --verbose --release --target ${{ matrix.target }}
- name: Run tests
run: cargo test --verbose
- name: Export Release Version
run: echo "RELEASE_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" >> $GITHUB_ENV
shell: sh
- name: Archive
if: ${{ !contains(matrix.os, 'windows') }}
uses: TheDoctor0/zip-release@0.7.6
with:
type: tar
filename: spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.tar.gz
directory: target/${{ matrix.target }}/release/
path: |
spotify-player-quickauth
- name: Archive
if: ${{ contains(matrix.os, 'windows') }}
uses: TheDoctor0/zip-release@0.7.6
with:
type: zip
filename: spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.zip
directory: target/${{ matrix.target }}/release/
path: |
spotify-player-quickauth.exe
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/${{ matrix.target }}/release/spotify-player-quickauth-v${{ env.RELEASE_VERSION }}-${{ matrix.target }}.*
generate_release_notes: true
# Publish flow
# - name: cargo login
# run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
# - name: "cargo release publish"
# run: cargo release publish --workspace --all-features --allow-branch HEAD --no-confirm --no-verify --execute