spotify-dl/.github/workflows/build-latest.yml
2024-05-10 23:00:40 +02:00

75 lines
2.1 KiB
YAML

name: Build latest
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: latest
release_name: Latest Build
build:
runs-on: ${{ matrix.platform }}
needs: create_release
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
include:
- platform: macos-latest
target: macos-x86_64
- platform: ubuntu-latest
target: linux-x86_64
- platform: windows-latest
target: windows-x86_64
# platform: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev gcc alsa
- name: Build
run: |
cargo build --verbose --release
- if: matrix.platform == 'windows-latest'
name: Rename binary
run: |
mv target/release/spotify-dl.exe target/release/spotify-dl.${{ matrix.target }}
- if: matrix.platform != 'windows-latest'
name: Rename binary
run: |
mv target/release/spotify-dl target/release/spotify-dl.${{ matrix.target }}
- name: Upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: target/release/spotify-dl.${{ matrix.target }}
asset_name: spotify-dl.${{ matrix.target }}
asset_content_type: application/octet-stream