-
Notifications
You must be signed in to change notification settings - Fork 55
157 lines (152 loc) · 5.53 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
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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]'
workflow_dispatch:
env:
TERM: xterm
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
defaults:
run:
working-directory: v2
permissions:
contents: write
jobs:
info:
name: Collect information for release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_info.outputs.version }}
tag: ${{ steps.get_info.outputs.tag }}
body: ${{ steps.get_info.outputs.body }}
prerelease: ${{ steps.get_info.outputs.prerelease }}
steps:
- uses: actions/checkout@v4
- name: Collect information
id: get_info
shell: bash
# $GITHUB_REF will have a value like "refs/tags/v0.3.1"
run: |
if ${{ github.event_name == 'workflow_dispatch' }}; then
echo "version=0.0.0" >> "$GITHUB_OUTPUT"
echo "tag=unreleased" >> "$GITHUB_OUTPUT"
echo "body=Pre-release assets for testing. Built at https://github.com/rhysd/Shiba/commit/$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF##refs/tags/v}" >> "$GITHUB_OUTPUT"
echo "tag=${GITHUB_REF##refs/tags/}" >> "$GITHUB_OUTPUT"
echo "body=" >> "$GITHUB_OUTPUT"
fi
echo "prerelease=${{ github.event_name == 'workflow_dispatch' }}" >> "$GITHUB_OUTPUT"
release-mac:
name: Build and upload macOS package
# Note: Binary built on macOS 13 cannot be run on macOS 12
runs-on: macos-12
needs: [info]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: v2/package-lock.json
- name: Build package
run: |
make Shiba.dmg
mv Shiba.dmg Shiba_v${{ needs.info.outputs.version }}.dmg
- name: Make binary zip for x86_64
run: |
make target/x86_64-apple-darwin/release/shiba
cp target/x86_64-apple-darwin/release/shiba shiba
zip shiba_macos_x86_64_v${{ needs.info.outputs.version }}.zip shiba
rm shiba
- name: Make binary zip for aarch64
run: |
make target/aarch64-apple-darwin/release/shiba
cp target/aarch64-apple-darwin/release/shiba shiba
zip shiba_macos_aarch64_v${{ needs.info.outputs.version }}.zip shiba
rm shiba
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.info.outputs.tag }}
body: ${{ needs.info.outputs.body }}
draft: false
prerelease: ${{ needs.info.outputs.prerelease }}
files: |
v2/Shiba_v${{ needs.info.outputs.version }}.dmg
v2/shiba_macos_x86_64_v${{ needs.info.outputs.version }}.zip
v2/shiba_macos_aarch64_v${{ needs.info.outputs.version }}.zip
release-windows:
name: Build and upload Windows installer and executable
runs-on: windows-latest
needs: [info]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: v2/package-lock.json
- name: Install WiX
run: |
dotnet tool install --global wix
wix --version
wix extension add WixToolset.UI.wixext WixToolset.Util.wixext
- name: Build executable
run: |
npm ci
npm run release
cargo build --release
cp target/release/shiba.exe shiba.exe
7z a shiba_windows_x86_64_v${{ needs.info.outputs.version }}.exe.zip shiba.exe
- name: Build .msi installer
run: |
wix --version
wix build -arch "x64" -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -out shiba_x64_v${{ needs.info.outputs.version }}.msi assets/wix/shiba.wxs -define ShibaVersion=${{ needs.info.outputs.version }}
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.info.outputs.tag }}
body: ${{ needs.info.outputs.body }}
draft: false
prerelease: ${{ needs.info.outputs.prerelease }}
files: |
v2/shiba_windows_x86_64_v${{ needs.info.outputs.version }}.exe.zip
v2/shiba_x64_v${{ needs.info.outputs.version }}.msi
release-linux:
name: Build and upload Linux executable
runs-on: ubuntu-latest
needs: [info]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: v2/package-lock.json
- run: sudo bash ./scripts/install_apt_deps.bash
- run: make target/release/shiba
- name: Archivfe executable
run: |
cp target/release/shiba ./shiba
zip --symlinks shiba_linux_x86_64_v${{ needs.info.outputs.version }}.zip shiba
- name: Build .deb package
run: |
set -x
cargo install cargo-deb
cargo deb --no-build --verbose
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.info.outputs.tag }}
body: ${{ needs.info.outputs.body }}
draft: false
prerelease: ${{ needs.info.outputs.prerelease }}
files: |
v2/shiba_linux_x86_64_v${{ needs.info.outputs.version }}.zip
v2/target/debian/shiba_${{ needs.info.outputs.version }}-1_amd64.deb