-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (38 loc) · 1.18 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
42
43
44
45
46
47
48
name: Release
on:
create:
tags:
- v[0-9]+.[0-9]+.[0-9]+
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Ensure Cargo.toml version matches git tag
run: |
toml_version=v$(sed -n 's/^version = "\(.*\)"/\1/p' < Cargo.toml)
actual_version=$(git describe --tags --abbrev=0)
if [[ "${toml_version}" != "${actual_version}" ]]; then
echo "Refusing to publish - toml version doesn't match tag version"
exit 1
else
echo "Git tag matches Cargo.toml, you may proceed :)"
fi
- name: Build
run: cargo build --release
- name: Publish to Crates.io
run: |
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --allow-dirty
- name: Bundle release artifacts
run: |
mkdir release
mv src/jtd-wrapper.sh release/jtd.sh
mv target/release/jtd release/jtd
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: release/*