Skip to content

Commit

Permalink
fix --version
Browse files Browse the repository at this point in the history
- add a check that `cargo build` doesn't result in a dirty git tree;
this ensures that `Cargo.toml` and `Cargo.lock` are in sync
- fix the `Cargo.lock`, which will in turn fix `--version`

Resolves #222
  • Loading branch information
yshavit authored Feb 28, 2025
1 parent 37aa8fd commit e357b2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build-release

name: build-release
on:
push:
branches: [ "main" ]
Expand Down Expand Up @@ -34,6 +34,13 @@ jobs:
- uses: actions/checkout@v4
- name: build
run: cargo build --release
- name: check for any changes in the git tree
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo '::error title=post-build check::changes detected in git tree'
git status
exit 1
fi
- name: Attest Build Provenance
uses: actions/attest-build-provenance@v1
with:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ jobs:
- uses: actions/checkout@v4
- name: cargo build
run: scripts/cargo_to_gh rustc --message-format json -- -Awarnings

- name: check for any changes in the git tree
run: |
exit_code=0
while read -r status_code file_path; do
if [[ -z "$status_code" ]]; then
continue
fi
exit_code=1
echo "::error file=$file_path,title=git-status::<$status_code> $file_path"
done <<<"$(git status --porcelain)"
exit "$exit_code"
check:
runs-on: ubuntu-latest
needs: build
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mdq"
version = "0.3.0"
version = "0.3.1"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "Select specific elements in a Markdown document"
Expand Down

0 comments on commit e357b2e

Please sign in to comment.