Skip to content

Commit 56acf5d

Browse files
committed
Add crates.io publishing workflow
1 parent dec760c commit 56acf5d

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish to crates.io
2+
on:
3+
push:
4+
tags: ['v*'] # Triggers when pushing tags starting with 'v'
5+
jobs:
6+
publish:
7+
if: github.repository == 'ruby/prism'
8+
runs-on: ubuntu-latest
9+
environment: release # Optional: for enhanced security
10+
permissions:
11+
id-token: write # Required for OIDC token exchange
12+
steps:
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
15+
with:
16+
egress-policy: audit
17+
- uses: actions/checkout@v5
18+
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@eaecf785f6a34567a6d97f686bbb7bccc1ac1e5c # v1.237.0
21+
with:
22+
ruby-version: ${{ matrix.ruby }}
23+
24+
- name: Set up Rust
25+
uses: dtolnay/rust-toolchain@master
26+
with:
27+
toolchain: stable
28+
targets: wasm32-wasip1
29+
30+
- name: Install dependencies
31+
run: bundle install --jobs 4 --retry 3
32+
33+
- uses: actions/cache@v4
34+
with:
35+
path: |
36+
~/.cargo/registry
37+
~/.cargo/git
38+
target
39+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
42+
${{ runner.os }}-cargo
43+
44+
- uses: rust-lang/crates-io-auth-action@v1
45+
id: auth
46+
47+
- run: bundle exec rake cargo:publish:real
48+
env:
49+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)