-
Notifications
You must be signed in to change notification settings - Fork 11
159 lines (137 loc) · 5.56 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
150
151
152
153
154
155
156
157
158
159
name: Release
permissions:
contents: write
on:
push:
branches: master
pull_request:
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
targets:
[
{
name: windows64,
fancy_name: windows,
runner: windows-latest,
target: x86_64-pc-windows-msvc,
ffmpeg_filename: ffmpeg-6.0-essentials_build.7z,
ffprobe_filename: "",
},
{
name: macos-intel,
fancy_name: macos-intel,
runner: macos-latest,
target: x86_64-apple-darwin,
ffmpeg_filename: ffmpeg6intel.zip,
ffprobe_filename: ffprobe6intel.zip,
},
{
name: macos-arm,
fancy_name: macos-apple-silicon,
runner: macos-latest,
target: aarch64-apple-darwin,
ffmpeg_filename: ffmpeg6arm.zip,
ffprobe_filename: ffprobe6arm.zip,
},
]
runs-on: ${{ matrix.targets.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
target: ${{ matrix.targets.target }}
- name: Cache dependencies
id: extcache
uses: Swatinem/rust-cache@v2
with:
cache-directories: ${{ github.workspace }}/ext/
prefix-key: "v1"
- name: Install cargo-binstall
uses: taiki-e/install-action@v2
with:
tool: cargo-binstall
- name: Install cargo-wix
if: ${{ matrix.targets.name == 'windows64' }}
run: cargo binstall cargo-wix --no-confirm --force
- name: Install cargo-bundle
if: ${{ matrix.targets.name == 'macos-intel' || matrix.targets.name == 'macos-arm'}}
run: cargo binstall cargo-bundle --no-confirm --force
- name: Build (Windows)
if: ${{ matrix.targets.name == 'windows64'}}
run: cargo build --release --features windows-installer
- name: Build (MacOS)
if: ${{ matrix.targets.name == 'macos-intel' || matrix.targets.name == 'macos-arm'}}
run: cargo build --release --target ${{ matrix.targets.target }} --features macos-app-bundle
- name: Extract ffmpeg
run: |
cd ${{ github.workspace }}/ext/ffmpeg/${{ matrix.targets.name }}
7z x ${{ matrix.targets.ffmpeg_filename }} -aoa
- name: Extract ffprobe
if: ${{ matrix.targets.name == 'macos-intel' || matrix.targets.name == 'macos-arm' }}
run: |
cd ${{ github.workspace }}/ext/ffmpeg/${{ matrix.targets.name }}
7z x ${{ matrix.targets.ffprobe_filename }} -aoa
- name: Create Windows installer
if: ${{ matrix.targets.name == 'windows64'}}
continue-on-error: true
run: |
cargo wix --package walksnail-osd-tool --include _deploy\windows\wix\main.wxs --nocapture --no-build
cd ${{ github.workspace }}/target/wix/
7z a temp.zip *.msi
mv temp.zip ${{ github.workspace }}/_deploy/walksnail-osd-tool-${{ matrix.targets.fancy_name }}.zip
shell: cmd
- name: Create Mac App bundle
if: ${{ matrix.targets.name == 'macos-intel' || matrix.targets.name == 'macos-arm'}}
run: |
cd ./ui
cargo bundle --release --target ${{ matrix.targets.target }} --features macos-app-bundle
cp ${{ github.workspace }}/ext/ffmpeg/${{ matrix.targets.name }}/ffmpeg ${{ github.workspace }}/target/${{ matrix.targets.target }}/release/bundle/osx/Walksnail\ OSD\ Tool.app/Contents/MacOS/ffmpeg
cp ${{ github.workspace }}/ext/ffmpeg/${{ matrix.targets.name }}/ffprobe ${{ github.workspace }}/target/${{ matrix.targets.target }}/release/bundle/osx/Walksnail\ OSD\ Tool.app/Contents/MacOS/ffprobe
cd ${{ github.workspace }}/target/${{ matrix.targets.target }}/release/bundle/osx/
codesign --force -s - Walksnail\ OSD\ Tool.app/Contents/MacOS/ffmpeg
codesign --force -s - Walksnail\ OSD\ Tool.app/Contents/MacOS/ffprobe
codesign --force -s - Walksnail\ OSD\ Tool.app/Contents/MacOS/walksnail-osd-tool
codesign --force -s - Walksnail\ OSD\ Tool.app
7z a temp.zip Walksnail\ OSD\ Tool.app
mv temp.zip ${{ github.workspace }}/_deploy/walksnail-osd-tool-${{ matrix.targets.fancy_name }}.zip
- name: Save binaries
uses: actions/upload-artifact@v3
with:
name: walksnail-osd-tool-all-platforms
path: ${{ github.workspace }}/_deploy/*.*
release:
name: Create GitHub release
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install parse-changelog
uses: taiki-e/install-action@v2
with:
tool: parse-changelog
- name: Generate release notes
run: parse-changelog ${{ github.workspace }}/CHANGELOG.md > ${{ github.workspace }}-release_notes.md
- name: Download artifacts
id: download
uses: actions/download-artifact@v3
with:
name: walksnail-osd-tool-all-platforms
path: ${{ github.workspace }}/_deploy/artifacts
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ steps.download.outputs.download-path }}/*
draft: true
body_path: ${{ github.workspace }}-release_notes.md