Skip to content

Commit 4e12a05

Browse files
committed
RSCBC-257: Update publish workflow to use cargo release
1 parent be2c2ad commit 4e12a05

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
1-
name: Publish crate
1+
name: Publish crates
22
on:
33
push:
44
tags:
55
- v*
66

77
jobs:
8+
tests:
9+
uses: ./.github/workflows/tests.yml
10+
secrets: inherit
11+
12+
dry-run:
13+
needs: tests
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Setup Rust toolchain and cache
19+
uses: actions-rust-lang/setup-rust-toolchain@v1
20+
21+
- name: Install cargo-release
22+
run: cargo install cargo-release --version 1.1.1 --locked
23+
24+
- name: Dry run
25+
run: cargo release --workspace
26+
827
publish:
28+
needs: dry-run
929
runs-on: ubuntu-latest
30+
environment: crates-io
31+
permissions:
32+
id-token: write
1033
steps:
1134
- uses: actions/checkout@v3
1235

1336
- name: Setup Rust toolchain and cache
1437
uses: actions-rust-lang/setup-rust-toolchain@v1
1538

16-
- name: Publish
39+
- name: Install cargo-release
40+
run: cargo install cargo-release --version 1.1.1 --locked
41+
42+
- uses: rust-lang/crates-io-auth-action@v1
43+
id: auth
44+
45+
- name: Publish crates
1746
env:
18-
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}
19-
run: |
20-
cargo publish -p couchbase-connstr
21-
cargo publish -p couchbase-core
22-
cargo publish -p couchbase
47+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
48+
run: cargo release --workspace --no-confirm --execute

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ name: Run Tests
22

33
on:
44
push:
5-
tags:
6-
- v*
75
branches:
86
- main
97
pull_request:
8+
workflow_call:
109
schedule:
1110
- cron: "0 5 * * *" # daily at 05:00 UTC
1211

release.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# cargo-release configuration
2+
# Run: cargo release --workspace --no-confirm --execute
3+
# Publishes crates in dependency order, skipping already-published versions.
4+
5+
# Don't publish protostellar to crates.io
6+
[[packages]]
7+
name = "protostellar"
8+
release = false
9+
10+
[workspace]
11+
# Only publish — no version bumping, commits, tags, or pushes
12+
publish = true
13+
push = false
14+
tag = false
15+
commit = false
16+
# Allow running from main branch or detached HEAD (e.g. CI on a tag)
17+
allow-branch = ["main", "HEAD"]

0 commit comments

Comments
 (0)