Merge pull request #13 from GuillemCastro/workflows

Merge workflows
This commit is contained in:
Guillem Castro 2024-05-13 23:08:19 +02:00 committed by GitHub
commit b16ff85449
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 206 additions and 204 deletions

50
.github/workflows/build-latest.yml vendored Normal file
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

42
.github/workflows/create-release.yml vendored Normal file
View file

@ -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] <github-actions[bot]@users.noreply.github.com>"
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 }}"

View file

@ -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 }}

View file

@ -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 }}

114
.github/workflows/release.yml vendored Normal file
View file

@ -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

View file

@ -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 }}