rustifydl 0.2.41

A fast, no-fuss Spotify downloader built in Rust.
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

permissions:
  contents: write

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            name: rustifydl-windows-x64.exe
            
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            name: rustifydl-linux-x64
            
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
          
      - name: Setup cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}
          
      - name: Build binary
        run: cargo build --verbose --locked --release --target ${{ matrix.target }}
        
      - name: Package binary (Windows)
        if: matrix.os == 'windows-latest'
        shell: pwsh
        run: |
          $binary = "target/${{ matrix.target }}/release/rustifydl.exe"
          $archive = "${{ matrix.name }}"
          Copy-Item $binary $archive
          
      - name: Package binary (Linux)
        if: matrix.os == 'ubuntu-latest'
        run: |
          binary="target/${{ matrix.target }}/release/rustifydl"
          archive="${{ matrix.name }}"
          cp "$binary" "$archive"
          
      - name: Upload binary
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.name }}
          path: ${{ matrix.name }}

  release:
    name: Create Release
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        
      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          path: ./artifacts
          
      - name: Create release
        uses: softprops/action-gh-release@v2
        with:
          draft: false
          prerelease: ${{ contains(github.ref_name, '-') }}
          generate_release_notes: true
          files: |
            ./artifacts/rustifydl-windows-x64.exe/rustifydl-windows-x64.exe
            ./artifacts/rustifydl-linux-x64/rustifydl-linux-x64
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}