-
Notifications
You must be signed in to change notification settings - Fork 7
41 lines (40 loc) · 1.24 KB
/
release.yml
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
name: Release
on:
push:
branches:
- main
paths:
- "Cargo.toml"
- ".github/workflows/release.yml"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install protobuf
uses: taiki-e/install-action@v2
with:
tool: protoc
- name: Checkout
uses: actions/checkout@v2
- name: Get version
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
- name: Check published version
run: echo PUBLISHED_VERSION=$(cargo search kcl --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV
- name: cargo login
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
- name: cargo package
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: |
cargo package
echo "We will publish:" $PACKAGE_VERSION
echo "This is current latest:" $PUBLISHED_VERSION
- name: Publish
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: |
echo "# Cargo Publish"
cargo publish --no-verify