Skip to content

Commit 9c48c1c

Browse files
committed
ci: Publish to crates.io
1 parent f19c357 commit 9c48c1c

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/_release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
description: 'The release tag (e.g. v1.0.0)'
77
required: true
88
type: string
9+
secrets:
10+
CARGO_REGISTRY_TOKEN:
11+
description: 'Token for publishing to crates.io'
12+
required: true
913

1014
env:
1115
CARGO_TERM_COLOR: always
@@ -55,3 +59,16 @@ jobs:
5559
gitopolis-windows-x86_64.zip
5660
gitopolis-macos-x86_64.tar.gz
5761
SHA256SUMS.txt
62+
63+
- name: Update Version for crates.io
64+
run: |
65+
VERSION="${{ inputs.release_tag }}"
66+
# Strip the 'v' prefix if present
67+
VERSION="${VERSION#v}"
68+
sed -i "s/0\\.0\\.0-git/$VERSION/" Cargo.toml
69+
sed -i "s/0\\.0\\.0-git/$VERSION/" Cargo.lock
70+
71+
- name: Publish to crates.io
72+
# --no-verify skips the verification build since CI already built and tested
73+
# --allow-dirty allows publishing with modified Cargo.toml/Cargo.lock (version update)
74+
run: cargo publish --no-verify --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/build-tag.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ jobs:
1515
uses: ./.github/workflows/_release.yml
1616
with:
1717
release_tag: ${{ github.ref_name }}
18+
secrets:
19+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)