-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (102 loc) · 3.4 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# This is a basic workflow to help you get started with Actions
name: Build macOS and Ubuntu
# Controls when the workflow will run
on:
# Triggers the workflow on release tags
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
- 'v[0-9]+.[0-9]+.[0-9]+*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release:
name: Release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Specify which operating systems these jobs are to run on
matrix:
include:
- os: ubuntu-latest
profile: release+static
target: x86_64-unknown-linux-musl
needs_musl: true
tar: tar
- os: ubuntu-latest
profile: release+static+aarch64
target: aarch64-unknown-linux-musl
needs_musl: true
tar: tar
- os: macos-11
profile: release+mac
target: x86_64-apple-darwin
tar: gtar
- os: macos-11
profile: release+mac+aarch64
target: aarch64-apple-darwin
tar: gtar
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup cargo make
uses: davidB/rust-cargo-make@v1
- name: Store git tag vars
shell: bash
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Install musl tools
if: matrix.needs_musl
run: >-
sudo apt-get install
clang
llvm
musl-tools
gcc-aarch64-linux-gnu
g++-aarch64-linux-gnu
binutils-aarch64-linux-gnu
qemu-user
- name: Install stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
default: true
- uses: Swatinem/rust-cache@v2
- name: Build
shell: bash
run: cargo make --profile ${{ matrix.profile }} build
- name: Package release
shell: bash
run: |
${{ matrix.tar }} -C target/${{ matrix.target }}/release -czf esthri-${{ env.VERSION }}-${{ matrix.target }}.tar.gz esthri${{ matrix.suffix }}
- name: Upload Release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.tar.gz"
tag: ${{ github.ref }}
overwrite: true
file_glob: true
post_release:
name: Post release
needs: [ release ]
runs-on: ubuntu-latest
steps:
- name: Store git tag vars
shell: bash
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Hook into package registry
uses: swift-nav/swift-cli-publisher@v2
env:
DL_LINUX_aarch64: "esthri-${{ env.VERSION }}-aarch64-unknown-linux-musl.tar.gz"
DL_LINUX_x86_64: "esthri-${{ env.VERSION }}-x86_64-unknown-linux-musl.tar.gz"
DL_MAC_aarch64: "esthri-${{ env.VERSION }}-aarch64-apple-darwin.tar.gz"
DL_MAC_x86_64: "esthri-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz"
DL_WIN: "" # Do not publish
TOOLS: "esthri"
with:
token: ${{ secrets.GH_TOKEN }}
gh-name: ${{ secrets.GH_NAME }}
gh-email: ${{ secrets.GH_EMAIL }}