Skip to content

Commit 0974f9e

Browse files
authored
Update rust.yml
1 parent fcab022 commit 0974f9e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/rust.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Rust Build and Release
33
on:
44
push:
55
branches:
6-
- main
6+
- main # Change this to your main branch name if different
77

88
jobs:
99
build:
@@ -20,15 +20,17 @@ jobs:
2020
profile: minimal
2121
toolchain: stable
2222

23-
- name: Read Cargo.toml
24-
id: read_cargo_toml
25-
run: echo ::set-output name=version::$(grep -oP '(?<=version = ")[^"]*' Cargo.toml)
23+
- name: Extract Version from Cargo.toml
24+
id: extract_version
25+
run: |
26+
VERSION=$(grep -Po '(?<=^version = ")[^"]*' Cargo.toml | head -n1)
27+
echo "::set-output name=version::${VERSION}"
2628
2729
- name: Build
2830
run: |
2931
cargo build --release
3032
env:
31-
APP_VERSION: ${{ steps.read_cargo_toml.outputs.version }}
33+
APP_VERSION: ${{ steps.extract_version.outputs.version }}
3234

3335
- name: Package Binary
3436
run: |
@@ -42,8 +44,8 @@ jobs:
4244
env:
4345
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4446
with:
45-
tag_name: v${{ steps.read_cargo_toml.outputs.version }}
46-
release_name: Release v${{ steps.read_cargo_toml.outputs.version }}
47+
tag_name: v${{ steps.extract_version.outputs.version }}
48+
release_name: Release v${{ steps.extract_version.outputs.version }}
4749
body: |
4850
Release description goes here
4951
draft: false

0 commit comments

Comments
 (0)