-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (73 loc) · 2.21 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
name: Release
on:
push:
tags: [ "v*" ]
workflow_dispatch: {}
defaults:
run:
shell: bash
jobs:
release:
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
name: Release ${{ matrix.target }}
steps:
- uses: actions/checkout@v3
- name: Determine release type
id: release-type
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo 'type=release' >> "$GITHUB_OUTPUT"
else
echo 'type=prerelease' >> "$GITHUB_OUTPUT"
fi
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-release-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-cargo
- name: Build CLI app
run: |
cargo build -p term-transcript-cli \
--profile=executable \
--target=${{ matrix.target }} \
--all-features \
--locked
- name: Package archive
id: package
run: ./cli/package.sh ${REF#"refs/tags/"}
env:
OS: ${{ matrix.os }}
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
- name: Publish archive
uses: softprops/action-gh-release@v1
if: github.event_name == "push"
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: ${{ steps.release-type.outputs.type == 'prerelease' }}
- name: Attach archive to action
uses: actions/upload-artifact@v3
if: github.event_name == "workflow_dispatch"
with:
name: term-transcript-${{ matrix.target }}
path: ${{ steps.package.outputs.archive }}