-
Notifications
You must be signed in to change notification settings - Fork 7
149 lines (143 loc) · 5.06 KB
/
release.yaml
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# taken from https://github.com/cargo-generate/cargo-generate/blob/master/.github/workflows/release.yml and
# https://github.com/cargo-generate/cargo-generate/blob/master/.github/workflows/release-binary-assets.yml and
# modified
## references:
# cache: https://github.com/actions/cache/blob/main/examples.md#rust---cargo
# audit: https://github.com/actions-rs/audit-check
# "needs": https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-beta.[0-9]+'
paths-ignore:
- "**/docs/**"
- "**.md"
jobs:
check:
name: check
strategy:
fail-fast: false
matrix:
version: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ]
runs-on: ${{ matrix.version }}
steps:
- uses: actions/checkout@v4
- name: setup | rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo check
lint:
name: lint
needs: check
strategy:
fail-fast: false
matrix:
version: [ 'macos-latest', 'ubuntu-20.04', 'windows-2022' ]
cargo-cmd:
- fmt --all -- --check
- clippy --all-targets --all-features -- -D warnings
runs-on: ${{ matrix.version }}
steps:
- uses: actions/checkout@v4
- name: setup | rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo ${{ matrix['cargo-cmd'] }}
release:
name: post / github release
needs: lint
runs-on: ubuntu-latest
environment: release
outputs:
version: ${{ steps.tag_name.outputs.current_version }}
steps:
- uses: actions/checkout@v4
- name: Get version from tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
shell: bash
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the "Get Changelog Entry" step above, referencing its ID to get its outputs object.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.tag_name.outputs.current_version }}
rba:
name: release binary assets
needs: release
runs-on: ${{ matrix.os }}
env:
CC_aarch64_unknown_linux_musl: "clang"
AR_aarch64_unknown_linux_musl: "llvm-ar"
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-20.04
binName: luminous-ttv
- target: aarch64-unknown-linux-musl
os: ubuntu-20.04
binName: luminous-ttv
- target: x86_64-apple-darwin
os: macos-latest
binName: luminous-ttv
- target: aarch64-apple-darwin
os: macos-latest
binName: luminous-ttv
- target: i686-pc-windows-msvc
os: windows-2022
binName: luminous-ttv.exe
- target: x86_64-pc-windows-msvc
os: windows-2022
binName: luminous-ttv.exe
steps:
- uses: actions/checkout@v4
- name: Install musl tools
if: ${{ contains(matrix.os, 'ubuntu') }}
run: sudo apt-get install -y musl-dev musl-tools clang llvm
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target=${{ matrix.target }}
- name: Smoke Test
if: ${{ !contains(matrix.target, 'aarch64') }}
run: cargo run --release --target=${{ matrix.target }} -- -V
- name: Move Binary
id: mv
run: mv "target/${{ matrix.target }}/release/${{ matrix.binName }}" .
- name: chmod binary #not working? ignored by zip action?
if: ${{ matrix.os == 'ubuntu-latest' }}
run: chmod +x "${{ matrix.binName }}"
- name: Zip Files
uses: vimtor/action-zip@v1
id: archive
with:
files: README.md LICENSE-GPL.txt LICENSE-MIT.txt ${{ matrix.binName }}
dest: luminous-ttv-${{ needs.release.outputs.version }}-${{ matrix.target }}.zip
- name: Upload Archive
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: luminous-ttv-${{ needs.release.outputs.version }}-${{ matrix.target }}.zip
artifactContentType: application/zip
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true