Skip to content

Commit ae731a0

Browse files
author
Qreta Dev
committed
feat(ga): checkout for cargo publish
1 parent 36251ad commit ae731a0

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@ jobs:
112112
if: startsWith(github.ref, 'refs/tags/v')
113113

114114
steps:
115+
- name: Checkout for cargo publish
116+
uses: actions/checkout@v4
117+
118+
- name: Verify tag version matches Cargo.toml
119+
run: |
120+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
121+
CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | awk -F'"' '{print $2}')
122+
123+
echo "Tag version: $TAG_VERSION"
124+
echo "Cargo.toml version: $CARGO_VERSION"
125+
126+
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
127+
echo "Error: Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
128+
echo "Please update Cargo.toml to version $TAG_VERSION or create a matching tag"
129+
exit 1
130+
fi
131+
132+
echo "Version match confirmed: $TAG_VERSION"
133+
115134
- name: Download all artifacts
116135
uses: actions/download-artifact@v4
117136
with:
@@ -160,6 +179,9 @@ jobs:
160179
cd ..
161180
done
162181
182+
- name: Publish to crates.io
183+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --allow-dirty
184+
163185
- name: Create release
164186
uses: softprops/action-gh-release@v2
165187
with:
@@ -172,6 +194,3 @@ jobs:
172194
- name: Publish to npm
173195
working-directory: artifacts/html2json
174196
run: npm publish --access public
175-
176-
- name: Publish to crates.io
177-
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "html2json"
3-
version = "0.5.10"
3+
version = "0.5.12"
44
edition = "2024"
55
description = "HTML to JSON extractor"
66
authors = ["Qreta Dev <qretadev@gmail.com>"]

0 commit comments

Comments
 (0)