Skip to content

Commit a28baaf

Browse files
committed
add workflow to publish Cargo automatically
1 parent 6d68563 commit a28baaf

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.github/workflows/release.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Publish Cargo to crates.io whenever a new tag is pushed. Tags are pushed by
2+
# the Rust release process (https://github.com/rust-lang/promote-release),
3+
# which will cause this workflow to run.
4+
5+
name: Release
6+
on:
7+
push:
8+
tags:
9+
- "**"
10+
11+
# Prevent multiple releases from starting at the same time.
12+
concurrency:
13+
group: release
14+
15+
jobs:
16+
crates-io:
17+
name: Publish on crates.io
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
22+
# Gain access to the crates.io publishing token.
23+
environment:
24+
name: release
25+
26+
steps:
27+
- name: Checkout the source code
28+
uses: actions/checkout@v4
29+
30+
- name: Publish Cargo to crates.io
31+
run: ./publish.py
32+
env:
33+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish.py

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
from urllib.error import HTTPError
1616

1717

18+
# Whenever you add a new crate to this list that does NOT start with "cargo-"
19+
# you must reach out to the infra team to add the crate to the list of crates
20+
# allowed to be published from the "cargo CI" crates.io token.
1821
TO_PUBLISH = [
1922
'credential/cargo-credential',
2023
'credential/cargo-credential-libsecret',

0 commit comments

Comments
 (0)