-
Notifications
You must be signed in to change notification settings - Fork 5
95 lines (77 loc) · 2.55 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
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
name: Make release
on:
push:
tags:
- "v*.*.*"
branches:
- release_testing
env:
CARGO_TERM_COLOR: always
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-binaries:
runs-on: ${{ matrix.config.os }}
name: Release ${{ matrix.config.os }} (${{ matrix.config.toolchain }})
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, toolchain: 'stable'}
- {os: ubuntu-latest, toolchain: 'stable'}
steps:
- uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.config.toolchain }}
override: true
# NB see https://github.com/actions-rs/cargo if we ever want to try cross
# e.g. for Mac M1/arm64
- name: Build and package binary
shell: bash
run: |
cargo install --path .
cp $HOME/.cargo/bin/ska .
tar czvf ska-${{ github.ref_name }}-${{ matrix.config.os }}-${{ matrix.config.toolchain }}.tar.gz ska LICENSE NOTICE README.md
- name: Upload package
if: success()
uses: actions/upload-artifact@v3
with:
name: ska-${{ github.ref_name }}-${{ matrix.config.os }}-${{ matrix.config.toolchain }}
path: ska-${{ github.ref_name }}-${{ matrix.config.os }}-${{ matrix.config.toolchain }}.tar.gz
create-release:
runs-on: ubuntu-latest
needs: build-binaries
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
path: build
- name: Organise files
shell: bash
run: |
cp build/ska-${{ github.ref_name }}-macOS-latest-stable/ska-${{ github.ref_name }}-macOS-latest-stable.tar.gz .
cp build/ska-${{ github.ref_name }}-ubuntu-latest-stable/ska-${{ github.ref_name }}-ubuntu-latest-stable.tar.gz .
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
fail_on_unmatched_files: true
generate_release_notes: true
files: |
ska-*.tar.gz
push_crate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v1
if: startsWith(github.ref, 'refs/tags/')
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}