Skip to content

Commit 7f7db97

Browse files
committed
ci: add publish-check and main-pr-checks jobs
1 parent 3cba3b9 commit 7f7db97

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,45 @@ jobs:
5151

5252
- name: Cargo test
5353
run: cargo test
54+
55+
publish-check:
56+
name: Publish Check (dry-run)
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Install Rust toolchain
62+
uses: dtolnay/rust-toolchain@stable
63+
64+
- name: Cache cargo registry
65+
uses: actions/cache@v4
66+
with:
67+
path: ~/.cargo/registry
68+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
69+
70+
- name: Cargo publish dry-run
71+
run: cargo publish --dry-run
72+
73+
main-pr-checks:
74+
name: Main PR Requirements
75+
if: github.base_ref == 'main'
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- name: Check version bump
81+
run: |
82+
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
83+
echo "Version in Cargo.toml: $CURRENT_VERSION"
84+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
85+
if [ -z "$LAST_TAG" ]; then
86+
echo "✅ First release (no previous tags)"
87+
else
88+
LAST_VERSION=${LAST_TAG#v}
89+
echo "Last tag version: $LAST_VERSION"
90+
if [ "$CURRENT_VERSION" = "$LAST_VERSION" ]; then
91+
echo "❌ Version in Cargo.toml must be bumped for PRs to main"
92+
exit 1
93+
fi
94+
echo "✅ Version bumped correctly"
95+
fi

0 commit comments

Comments
 (0)