Skip to content

Commit 82073d1

Browse files
authored
feat: use trusted publishing for all releasing (#116)
1 parent c8b3c2f commit 82073d1

File tree

4 files changed

+76
-9
lines changed

4 files changed

+76
-9
lines changed

.github/workflows/crates-io.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish to crates.io
2+
on:
3+
push:
4+
tags: ["v*"]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
environment: crates-io
10+
permissions:
11+
id-token: write
12+
steps:
13+
- uses: actions/checkout@v5
14+
- uses: rust-lang/crates-io-auth-action@v1
15+
id: auth
16+
- run: cargo publish
17+
env:
18+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

.github/workflows/npm.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
name: Build WASM package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
- uses: Swatinem/rust-cache@v2
15+
- name: Install wasm-pack
16+
uses: jetli/wasm-pack-action@v0.4.0
17+
with:
18+
version: "latest"
19+
- name: Build WASM for npm
20+
run: wasm-pack build --target web --out-dir pkg wasm
21+
- name: Upload package
22+
uses: actions/upload-artifact@v5
23+
with:
24+
name: npm-package
25+
path: wasm/pkg
26+
27+
publish:
28+
name: Publish to npm
29+
runs-on: ubuntu-latest
30+
needs: build
31+
permissions:
32+
id-token: write
33+
contents: read
34+
attestations: write
35+
environment:
36+
name: npm
37+
url: https://www.npmjs.com/package/cql2-wasm
38+
steps:
39+
- uses: actions/download-artifact@v6
40+
with:
41+
name: npm-package
42+
path: package
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: "20"
46+
- name: Generate artifact attestation
47+
uses: actions/attest-build-provenance@v3
48+
with:
49+
subject-path: "package/*"
50+
- name: Publish to npm
51+
working-directory: package
52+
run: npm publish --provenance --access public

.github/workflows/python.yml renamed to .github/workflows/pypi.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ jobs:
148148
id-token: write
149149
contents: write
150150
attestations: write
151+
environment:
152+
name: pypi
153+
url: https://pypi.org/project/cql2/
151154
steps:
152155
- uses: actions/download-artifact@v6
153156
- name: Generate artifact attestation
@@ -157,8 +160,6 @@ jobs:
157160
- name: Publish to PyPI
158161
if: startsWith(github.ref, 'refs/tags/')
159162
uses: PyO3/maturin-action@v1
160-
env:
161-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
162163
with:
163164
command: upload
164165
args: --non-interactive --skip-existing wheels-*/*

RELEASING.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# Releasing
22

3-
Setup:
4-
5-
- Install [cargo-release](https://github.com/crate-ci/cargo-release): `cargo install cargo-release`
6-
7-
Then:
8-
93
1. Create a new branch: `release/vX.Y.Z`
104
2. Update the version in `Cargo.toml`
115
3. Update the CHANGELOG
126
4. Update each README
137
5. Open a PR
148
6. Once approved, merge the PR
15-
7. `cargo release -p cql2 --execute`, then `cargo release -p cql2-cli --execute`
9+
7. `git tag -s vX.Y.Z`
10+
8. `git push origin vX.Y.Z`
11+
9. Create a new [release](https://github.com/developmentseed/cql2-rs/releases) for your tag

0 commit comments

Comments
 (0)