Skip to content

Commit 424b92d

Browse files
committed
ci: Enhance release workflow to output new version and publish conditionally
Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 709e46b commit 424b92d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
runs-on: ubuntu-24.04
1414
permissions:
1515
contents: write
16+
outputs:
17+
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
18+
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
1619
steps:
1720
- uses: actions/checkout@v4
1821
with:
@@ -36,6 +39,7 @@ jobs:
3639
@semantic-release/github
3740
3841
- name: Create a release if needed
42+
id: semantic
3943
run: |
4044
semantic-release
4145
env:
@@ -45,16 +49,24 @@ jobs:
4549
publish:
4650
needs: github_release
4751
runs-on: ubuntu-24.04
52+
if: needs.github_release.outputs.new_release_published == 'true'
4853
name: Publish
4954
steps:
5055
- uses: actions/checkout@v4
56+
with:
57+
ref: main
5158

5259
- name: Install Rust
5360
uses: dtolnay/rust-toolchain@stable
5461

5562
- name: Cache dependencies
5663
uses: Swatinem/rust-cache@v2
5764

65+
- name: Update Cargo.toml version
66+
run: |
67+
echo "Updating to version ${{ needs.github_release.outputs.new_release_version }}"
68+
sed -i "s/^version = .*/version = \"${{ needs.github_release.outputs.new_release_version }}\"/" Cargo.toml
69+
5870
- name: Build
5971
run: cargo build --verbose --release
6072

0 commit comments

Comments
 (0)