Skip to content

Commit 77e9e44

Browse files
bergwolfjiangliu
authored andcommitted
actions: add release workflow
It help to create github release and publish to crate.io automatically when a new tag is pushed. Signed-off-by: Peng Tao <[email protected]>
1 parent 755e8c7 commit 77e9e44

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Publish
18+
run: |
19+
sudo apt-get update && sudo apt-get install -y sed
20+
VERSION=$(sed -E -n 's/^version = \"(.*)"$/\1/p' Cargo.toml)
21+
[ "$GITHUB_REF_NAME" == "v$VERSION" ]
22+
cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
23+
- name: Release
24+
uses: softprops/action-gh-release@v1

0 commit comments

Comments
 (0)