-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (170 loc) · 6.53 KB
/
build.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Build and Release
on:
push:
tags:
- "v*.*.*" # trigger when tag is vX.X.X
workflow_dispatch:
inputs:
tag:
description: "Tag to build and release"
required: true
default: "v0.0.0"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
build-platform: linux/amd64
build-name: crypto-monitor
- os: macos-latest
build-platform: darwin/universal
build-name: crypto-monitor
- os: windows-latest
build-platform: windows/amd64
installer-name: crypto-monitor-installer.exe
executable-name: crypto-monitor-windows-amd64.exe
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup GoLang
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install Linux Wails deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install Go Dependencies
run: go mod tidy
- name: Install frontend dependencies
run: |
cd frontend
npm install
- name: Build Wails App (Non-Windows)
if: runner.os != 'Windows'
run: |
wails build --platform ${{ matrix.build-platform }} -webview2 download -o ${{ matrix.build-name }}
working-directory: ./
- name: Build Windows Installer
if: runner.os == 'Windows'
run: |
wails build --platform ${{ matrix.build-platform }} -webview2 download -nsis -o ${{ matrix.installer-name }}
- name: Build Windows Executable
if: runner.os == 'Windows'
run: |
wails build --platform ${{ matrix.build-platform }} -webview2 download -o ${{ matrix.executable-name }}
- name: List Build Directory
run: |
echo "Listing build directory:"
ls -al ./build/bin
- name: Upload Build Artifact (Non-Windows)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v3
with:
name: crypto-monitor-${{ matrix.os }}
path: ./build/bin/${{ matrix.build-name }}
- name: Upload Windows Installer Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: crypto-monitor-windows-installer
path: ./build/bin/${{ matrix.installer-name }}
- name: Upload Windows Executable Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: crypto-monitor-windows-executable
path: ./build/bin/${{ matrix.executable-name }}
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Download Non-Windows Ubuntu Artifact
uses: actions/download-artifact@v3
with:
name: crypto-monitor-ubuntu-latest
path: ./artifacts/ubuntu-latest
- name: Download Non-Windows macOS Artifact
uses: actions/download-artifact@v3
with:
name: crypto-monitor-macos-latest
path: ./artifacts/macos-latest
- name: Download Windows Installer Artifact
uses: actions/download-artifact@v3
with:
name: crypto-monitor-windows-installer
path: ./artifacts/windows-installer
- name: Download Windows Executable Artifact
uses: actions/download-artifact@v3
with:
name: crypto-monitor-windows-executable
path: ./artifacts/windows-executable
- name: Get Version
id: get_version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
VERSION=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
shell: bash
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
draft: false
prerelease: false
- name: Upload Windows Installer Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows-installer/${{ matrix.installer-name }}
asset_name: crypto-monitor-${{ env.VERSION }}-windows-amd64-installer.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload Windows Executable Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows-executable/${{ matrix.executable-name }}
asset_name: crypto-monitor-${{ env.VERSION }}-windows-amd64.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/macos-latest/${{ matrix.build-name }}
asset_name: crypto-monitor-${{ env.VERSION }}-macos-universal.app
asset_content_type: application/x-apple-app
- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/ubuntu-latest/${{ matrix.build-name }}
asset_name: crypto-monitor-${{ env.VERSION }}-linux-amd64
asset_content_type: application/x-elf
- name: List Artifacts Directories
run: |
echo "Listing Windows Installer Directory:"
ls -al ./artifacts/windows-installer/
echo "Listing Windows Executable Directory:"
ls -al ./artifacts/windows-executable/