-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (110 loc) · 3.98 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
name: Release
on:
release:
types: [ created ]
jobs:
build:
strategy:
matrix:
include:
- runs-on: ubuntu-latest
binary-name: hosts-switch_linux_amd64_${{ github.ref_name }}
binary-path: ./build/linux/
format: '.deb'
- runs-on: windows-latest
binary-name: hosts-switch_windows_amd64_${{ github.ref_name }}
binary-path: ./build/bin/
format: '.exe'
- runs-on: macos-latest
binary-name: hosts-switch_darwin_amd64_${{ github.ref_name }}
binary-path: ./build/bin/
format: '.app'
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: v16.14.2
registry-url: https://registry.npmjs.com/
- name: Install Vue Dependencies
run: |
cd frontend
npm install
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.2
- name: Set up Linux Environment
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
run: |
sudo apt-get install libwebkit2gtk-4.0-dev
sudo apt install libgtk-3-dev
sudo apt install nsis
#- name: Run Windows UPX
# if: ${{ matrix.runs-on == 'windows-latest' }}
# uses: crazy-max/ghaction-upx@v2
# with:
# version: v3.96
# files: |
# ./build/bin/hosts-switch.exe
# args: -fq
#- name: Set Windows UPX
# run: setx -m PATH '%PATH%;C:\hostedtoolcache\windows\ghaction-upx\3.96\x64\upx-3.96-win64\'
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/[email protected]
- name: Check Environment
run: wails doctor
- name: Build Linux
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
run: |
cd scripts
sh build-linux-deb.sh ${{ github.ref_name }}
- name: Build Windows
if: ${{ matrix.runs-on == 'windows-latest' }}
# run: wails build --clean --platform windows -nsis -webview2 embed
run: |
wails build --clean --platform windows -webview2 Embed
cd ${{ matrix.binary-path }}
ren hosts-switch.exe ${{ matrix.binary-name }}${{ matrix.format }}
- name: Build MacOs
if: ${{ matrix.runs-on == 'macos-latest' }}
run: |
wails build --clean --platform darwin/amd64
cd ${{ matrix.binary-path }}
mv hosts-switch.app ${{ matrix.binary-name }}${{ matrix.format }}
- name: Archive Release
uses: thedoctor0/zip-release@main
with:
type: zip
filename: ${{ matrix.binary-name }}.zip
directory: ${{ matrix.binary-path }}
path: .
# exclusions: '*.git* /*node_modules/* .editorconfig'
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
if: ${{ matrix.runs-on != 'macos-latest' }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ matrix.binary-path }}${{ matrix.binary-name }}${{ matrix.format }}
asset_name: ${{ matrix.binary-name }}${{ matrix.format }}
asset_content_type: application/octet-stream
- name: Upload Release Zip Asset
id: upload-release-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ matrix.binary-path }}${{ matrix.binary-name }}.zip
asset_name: ${{ matrix.binary-name }}.zip
asset_content_type: application/zip