Skip to content

Commit

Permalink
fix: enhance build workflow to extract and validate version from meta…
Browse files Browse the repository at this point in the history
…data
  • Loading branch information
kaorlol committed Dec 23, 2024
1 parent 4011136 commit f5b4470
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ jobs:
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2

- name: Metadata
run: cargo metadata --no-deps --format-version 1 > metadata.json

- name: Extract Version
id: version
run: echo "VERSION=$(jq -r '.packages[0].version' metadata.json)" >> $GITHUB_ENV

- name: Check Version
run: |
$VERSION = cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'
echo "Latest version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
if [ -z "$VERSION" ]; then
echo "No version found, skipping release"
exit 1
fi
- name: Build
run: cargo build --release --verbose
Expand All @@ -45,6 +51,7 @@ jobs:
powershell -Command "Compress-Archive -Path target/release/lunar-stitch.exe -DestinationPath release/lunar-stitch-${{ env.VERSION }}-windows.zip"
- name: Release
if: env.VERSION != 'none'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit f5b4470

Please sign in to comment.