Skip to content

Commit

Permalink
accept release version as workflow input
Browse files Browse the repository at this point in the history
  • Loading branch information
derklaro committed Jan 31, 2024
1 parent 1ffd470 commit 33feb8f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ on:
inputs:
release:
type: boolean
default: false
description: Publish Release
version:
required: true
description: 'Version string, e.g. 2.3.1'

concurrency:
cancel-in-progress: true
Expand Down Expand Up @@ -44,9 +48,6 @@ jobs:
runs-on: ${{ matrix.platform.os }}
name: Compile ${{ matrix.platform.target }} / ${{ matrix.platform.os }}

outputs:
release_version: ${{ steps.get_release_version.outputs.version }}

strategy:
fail-fast: true
matrix:
Expand All @@ -59,13 +60,6 @@ jobs:
- { os: 'ubuntu-latest', target: 'aarch64-unknown-linux-musl', arch: 'aarch64', osn: 'linux' }

steps:
- name: Get release version
id: get_release_version
env:
RUN: ${{ github.run_number }}
ATTEMPT: ${{ github.run_attempt }}
run: echo "version=0.$RUN.$(($ATTEMPT - 1))" >> $GITHUB_OUTPUT;

- name: Checkout repository
uses: actions/checkout@v4

Expand All @@ -76,10 +70,12 @@ jobs:
targets: ${{ matrix.platform.target }}

- name: Install Cargo Edit
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true' }}
run: cargo install cargo-edit

- name: Set Crate Version
run: cargo set-version ${{ steps.get_release_version.outputs.version }}
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true' }}
run: cargo set-version ${{ github.event.inputs.version }}

- name: Initialize Rust caching
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -134,7 +130,7 @@ jobs:
with:
draft: false
prerelease: false
tag_name: ${{ needs.build.outputs.release_version }}
tag_name: ${{ github.event.inputs.version }}
body: ${{steps.changelog_generate.outputs.changelog}}
fail_on_unmatched_files: true
files: |
Expand Down

0 comments on commit 33feb8f

Please sign in to comment.