-
Notifications
You must be signed in to change notification settings - Fork 4
39 lines (34 loc) · 1.01 KB
/
publish.yml
File metadata and controls
39 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Publish
permissions:
contents: write
attestations: write
pull-requests: write
on:
release:
types:
- published
jobs:
upload_release:
name: Upload release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Include all history and tags, needed for building the right version
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
- name: Install Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: "stable"
- uses: Swatinem/rust-cache@v2
- name: Publish tag ${{ github.event.release.tag_name }} crate to crates.io
env:
CARGO_REGISTRY_TOKEN: "${{secrets.CRATES_IO_TOKEN}}"
run: |
# Get tag name from event
tag_name="${{ github.event.release.tag_name }}"
if [[ ! "$tag_name" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
cd $(echo $tag_name | rev | cut -d'/' -f2- | rev)
fi
cargo publish --registry crates-io