Skip to content

Commit 33feb8f

Browse files
author
derklaro
committed
accept release version as workflow input
1 parent 1ffd470 commit 33feb8f

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ on:
99
inputs:
1010
release:
1111
type: boolean
12+
default: false
1213
description: Publish Release
14+
version:
15+
required: true
16+
description: 'Version string, e.g. 2.3.1'
1317

1418
concurrency:
1519
cancel-in-progress: true
@@ -44,9 +48,6 @@ jobs:
4448
runs-on: ${{ matrix.platform.os }}
4549
name: Compile ${{ matrix.platform.target }} / ${{ matrix.platform.os }}
4650

47-
outputs:
48-
release_version: ${{ steps.get_release_version.outputs.version }}
49-
5051
strategy:
5152
fail-fast: true
5253
matrix:
@@ -59,13 +60,6 @@ jobs:
5960
- { os: 'ubuntu-latest', target: 'aarch64-unknown-linux-musl', arch: 'aarch64', osn: 'linux' }
6061

6162
steps:
62-
- name: Get release version
63-
id: get_release_version
64-
env:
65-
RUN: ${{ github.run_number }}
66-
ATTEMPT: ${{ github.run_attempt }}
67-
run: echo "version=0.$RUN.$(($ATTEMPT - 1))" >> $GITHUB_OUTPUT;
68-
6963
- name: Checkout repository
7064
uses: actions/checkout@v4
7165

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

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

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

8480
- name: Initialize Rust caching
8581
uses: Swatinem/rust-cache@v2
@@ -134,7 +130,7 @@ jobs:
134130
with:
135131
draft: false
136132
prerelease: false
137-
tag_name: ${{ needs.build.outputs.release_version }}
133+
tag_name: ${{ github.event.inputs.version }}
138134
body: ${{steps.changelog_generate.outputs.changelog}}
139135
fail_on_unmatched_files: true
140136
files: |

0 commit comments

Comments
 (0)