This repository has been archived by the owner on Jul 13, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (58 loc) · 2.2 KB
/
windows-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
name: Windows (Zip & Installer)
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: npm
- uses: subosito/flutter-action@v1.5.3
with:
channel: master
- name: 🚧 Do prerequisites
run: |
flutter config --enable-windows-desktop
flutter pub get
npm ci
npm run generator:run
- name: 🚩 Check for existing releases
run: npm run actions:check-release -- '-windows.zip' '-windows.exe'
- name: 🔨 Building binaries
run: npm run windows:build
- name: 📦 Packing as zip
run: npm run windows:build:zip
- name: 📦 Packing as installer
run: npm run windows:build:installer
- name: 🔢 Get version
uses: actions/github-script@v4
id: app_version
with:
result-encoding: string
script: |
const spawn = require("cross-spawn");
const result = spawn.sync("npm", ["run", "version:print", "-s"]);
if (result.status != 0) {
throw new Error(result.stderr.toString());
}
return result.stdout.toString().trim();
- name: 📝 Get files
uses: actions/github-script@v4
id: app_files
with:
result-encoding: string
script: |
const fg = require("fast-glob");
return fg.sync("build/packed/windows/*-windows.{exe,zip}").join("\n");
- name: 🚀 Release exe and zip
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.app_version.outputs.result }}
files: ${{ steps.app_files.outputs.result }}
draft: true