-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (67 loc) · 2.05 KB
/
publish.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
on:
release:
types: [published]
name: Cargo Publish
jobs:
publish_crate:
name: Cargo Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Use Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Publish crate
run: |
TAG_NAME=${{ github.event.release.tag_name }}
PREFIX=$(echo $TAG_NAME | cut -d'-' -f1)
case "$PREFIX" in
"sdf")
CRATE_NAME="sdf_glyph_renderer"
;;
"tools")
CRATE_NAME="pbf_font_tools"
;;
"cli")
CRATE_NAME="build_pbf_glyphs"
;;
*)
echo "Invalid prefix in tag: $PREFIX"
exit 1
esac
cargo publish --all-features -p $CRATE_NAME
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish_cli_binary:
name: Release build with ${{ matrix.os }}
if: startsWith(github.event.release.tag_name, 'cli-')
strategy:
fail-fast: true
# TODO: Not sure I agree with this setup of different runners; seems like we should use cross or something
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Use Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features --release
- name: Push Artifacts
run: |
mv target/release/build_pbf_glyphs target/release/build_pbf_glyphs.${{ matrix.target }}
gh release upload ${{ github.event.release.tag_name }} target/release/build_pbf_glyphs.${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}