diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..78a12b5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,71 @@ +name: Release + +on: + push: + tags: + - "v*" + +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: ${{ github.ref }} + release_name: Release ${{ github.ref }} + + build: + runs-on: ${{ matrix.platform }} + + 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 }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 177a5fd..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Rust - -on: - push: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ${{ matrix.platform }} - - 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 - - name: Rename binary - run: | - mv target/release/spotify-dl* target/release/spotify-dl.${{ matrix.target }} - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: true - title: "Latest Build" - files: | - LICENSE - target/release/spotify-dl*