spotify-dl/.github/workflows/create-release.yml
2024-05-17 18:50:26 +02:00

68 lines
2.1 KiB
YAML

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: Run semver-diff
if: inputs.release_type == ''
id: semver-diff
uses: tj-actions/semver-diff@v3
with:
initial_release_type: ${{ inputs.release_type }}
- name: Install stable toolchain
if: steps.semver-diff.outputs.release_type != '' || inputs.release_type != ''
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v4
if: steps.semver-diff.outputs.release_type != '' || inputs.release_type != ''
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-cargo-bump
- name: Bump Cargo.toml version
shell: bash
if: steps.semver-diff.outputs.release_type != '' || inputs.release_type != ''
working-directory: '.'
run: |
cargo install cargo-bump --force
if [[ -z "${{ inputs.release_type }}" ]]; then
cargo bump ${{ steps.semver-diff.outputs.release_type }}
else
cargo bump ${{ inputs.release_type }}
fi
cargo update --workspace
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Bump version to v${{ steps.semver-diff.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
- name: Create tag
uses: rickstaa/action-create-tag@v1
with:
tag: v${{ steps.semver-diff.outputs.new_version }}
message: "Bump version to v${{ steps.semver-diff.outputs.new_version }}"