-
Notifications
You must be signed in to change notification settings - Fork 21
51 lines (50 loc) · 1.48 KB
/
rust-release.yaml
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
40
41
42
43
44
45
46
47
48
49
50
51
# 相当于脚本用途的一个声明
name: Release-Rust
# 触发脚本的事件 这里为发布release之后触发
on:
release:
types: [ published ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout code for rust
# Reference your environment variables
uses: actions/[email protected]
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build rust
run: |
cd source/rust/polaris-specification
echo "run sed start"
sed -i 's/^version = ".*"/version = "'${VERSION:1}'"/g' Cargo.toml
echo "run sed end"
cat Cargo.toml
pwd
cd ../
bash build.sh
cd polaris-specification
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Run cargo login
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CRATES_IO_TOKEN }}
- name: Run cargo publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --package polaris-specification --allow-dirty