Release-Rust #36
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 相当于脚本用途的一个声明 | |
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 |