From db6f2ce59e437b61bb8f839a087ddb9d3dde28a0 Mon Sep 17 00:00:00 2001 From: Guillem Castro Date: Mon, 13 May 2024 23:01:52 +0200 Subject: [PATCH] Merge workflows --- .github/workflows/build-latest.yml | 50 ++++++++++++ .github/workflows/build-linux.yml | 27 ------- .github/workflows/build-macos.yml | 26 ------ .github/workflows/build-windows.yml | 27 ------- .github/workflows/create-release.yml | 42 ++++++++++ .github/workflows/linux.yml | 40 ---------- .github/workflows/macos.yml | 45 ----------- .github/workflows/release.yml | 114 +++++++++++++++++++++++++++ .github/workflows/windows.yml | 39 --------- 9 files changed, 206 insertions(+), 204 deletions(-) create mode 100644 .github/workflows/build-latest.yml delete mode 100644 .github/workflows/build-linux.yml delete mode 100644 .github/workflows/build-macos.yml delete mode 100644 .github/workflows/build-windows.yml create mode 100644 .github/workflows/create-release.yml delete mode 100644 .github/workflows/linux.yml delete mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml new file mode 100644 index 0000000..43667c0 --- /dev/null +++ b/.github/workflows/build-latest.yml @@ -0,0 +1,50 @@ +name: Build latest + +on: + push: + branches: + - '*' + +env: + CARGO_TERM_COLOR: always + +permissions: + contents: write + +jobs: + + linux: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release + + macos: + runs-on: macos-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release + + windows: + runs-on: windows-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml deleted file mode 100644 index 315af8e..0000000 --- a/.github/workflows/build-linux.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build latest - Linux - -on: - push: - branches: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - name: Build - run: | - cargo build --verbose --release - diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml deleted file mode 100644 index 6e96b8e..0000000 --- a/.github/workflows/build-macos.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Build latest - MacOS - -on: - push: - branches: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - - build: - runs-on: macos-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - name: Build - run: | - cargo build --verbose --release diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml deleted file mode 100644 index ee6c4e7..0000000 --- a/.github/workflows/build-windows.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build latest - Windows - -on: - push: - branches: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - - build: - runs-on: windows-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - name: Build - run: | - cargo build --verbose --release - diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..62a43b7 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,42 @@ +name: Create Release + +on: + workflow_dispatch: + inputs: + release_type: + description: 'Type of release to create' + required: true + default: 'minor' + type: choice + options: + - patch + - minor + - major + +jobs: + + bump-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Bump version + uses: tj-actions/cargo-bump@v3 + with: + release_type: ${{ github.event.inputs.release_type }} + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Bump version to v${{ steps.bump-version.outputs.new_version }}" + commit_user_name: "github-actions[bot]" + commit_user_email: "github-actions[bot]@users.noreply.github.com" + commit_author: "github-actions[bot] " + branch: master + create-tag: + runs-on: ubuntu-latest + needs: bump-version + steps: + - name: Create tag + uses: rickstaa/action-create-tag@v1 + with: + tag: v${{ steps.bump-version.outputs.new_version }} + message: "Bump version to v${{ steps.bump-version.outputs.new_version }}" diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index 566c07e..0000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Release - Linux - -on: - push: - tags: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - name: Build - run: | - cargo build --verbose --release - - name: Rename binary - run: | - mv target/release/spotify-dl target/release/spotify-dl.linux-x86_64 - - name: Upload Linux Artifact - uses: ncipollo/release-action@v1 - with: - allowUpdates: True - makeLatest: True - omitBody: True - omitBodyDuringUpdate: True - omitNameDuringUpdate: True - artifacts: target/release/spotify-dl.linux-x86_64 - token: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index afbc1e1..0000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Release - MacOS - -on: - push: - tags: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - - build: - runs-on: macos-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - name: Build - run: | - cargo build --verbose --release - - name: Compress binary - run: | - tar -czvf target/release/spotify-dl.macos.tar.gz target/release/spotify-dl - - name: SHA 256 - run: | - shasum -a 256 target/release/spotify-dl.macos.tar.gz - - name: Rename binary - run: | - mv target/release/spotify-dl target/release/spotify-dl.macos - - name: Upload MacOS Artifact - uses: ncipollo/release-action@v1 - with: - allowUpdates: True - makeLatest: True - omitBody: True - omitBodyDuringUpdate: True - omitNameDuringUpdate: True - artifacts: target/release/spotify-dl.macos, target/release/spotify-dl.macos.tar.gz - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7596c18 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,114 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + CARGO_TERM_COLOR: always + +permissions: + contents: write + +jobs: + + linux: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release + - name: Rename binary + run: | + mv target/release/spotify-dl target/release/spotify-dl.linux-x86_64 + - name: Upload Linux Artifact + uses: ncipollo/release-action@v1 + with: + allowUpdates: True + makeLatest: True + omitBody: True + omitBodyDuringUpdate: True + omitNameDuringUpdate: True + artifacts: target/release/spotify-dl.linux-x86_64 + token: ${{ secrets.GITHUB_TOKEN }} + + macos: + runs-on: macos-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release + - name: Rename binary + run: | + mv target/release/spotify-dl target/release/spotify-dl.macos-aarch64 + - name: Upload MacOS Artifact + uses: ncipollo/release-action@v1 + with: + allowUpdates: True + makeLatest: True + omitBody: True + omitBodyDuringUpdate: True + omitNameDuringUpdate: True + artifacts: target/release/spotify-dl.macos-aarch64 + token: ${{ secrets.GITHUB_TOKEN }} + + windows: + runs-on: windows-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release + - name: Rename binary + run: | + mv target/release/spotify-dl.exe target/release/spotify-dl.windows-x86_64 + - name: Upload Windows Artifact + uses: ncipollo/release-action@v1 + with: + allowUpdates: True + makeLatest: True + omitBody: True + omitBodyDuringUpdate: True + omitNameDuringUpdate: True + artifacts: target/release/spotify-dl.windows-x86_64 + token: ${{ secrets.GITHUB_TOKEN }} + + cargo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - name: Build + run: | + cargo build --verbose --release + - name: Run cargo publish + run: | + cargo publish --token ${{ secrets.CARGO_TOKEN }} + + homebrew: + runs-on: ubuntu-latest + steps: + - name: Update Hombrew formula + uses: dawidd6/action-homebrew-bump-formula@v3 + with: + tap: guillemcastro/spotify-dl + formula: spotify-dl + token: ${{ secrets.HOMEBREW_TOKEN }} + tag: ${{ github.ref }} + no_fork: true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 70fca7c..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Release - Windows - -on: - push: - tags: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - - build: - runs-on: windows-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - name: Build - run: | - cargo build --verbose --release - - name: Rename binary - run: | - mv target/release/spotify-dl.exe target/release/spotify-dl.windows-x86_64 - - name: Upload Windows Artifact - uses: ncipollo/release-action@v1 - with: - allowUpdates: True - makeLatest: True - omitBody: True - omitBodyDuringUpdate: True - omitNameDuringUpdate: True - artifacts: target/release/spotify-dl.windows-x86_64 - token: ${{ secrets.GITHUB_TOKEN }}