forked from saber-notes/saber
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 2.32 KB
/
windows.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
name: Build for Windows
on:
# Enable manual run
workflow_dispatch:
push:
tags:
- '**'
branches:
- '**'
paths:
- .github/workflows/windows.yml
- installers/desktop_inno_script.iss
jobs:
build-windows:
name: Build for Windows
runs-on: windows-latest
permissions:
contents: write
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup cache
uses: actions/cache@v4
with:
path: |
build
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }}
restore-keys: |
${{ runner.OS }}-saber-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Disable Flutter CLI animations
run: flutter config --no-cli-animations
- run: flutter pub get
- name: Build Windows
shell: bash
run: |
flutter build windows \
--dart-define=DIRTY=$DIRTY
env:
DIRTY: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Download Visual C++ Redistributable
shell: bash
run: |
curl -L -o installers/vc_redist.x64.exe https://aka.ms/vs/17/release/vc_redist.x64.exe
- name: Build Windows Installer
run: ISCC.exe installers/desktop_inno_script.iss
- name: Rename exe
id: rename
shell: bash
run: |
export LC_ALL=en_US.utf8
buildName=$(grep -oP "(?<=buildName = ').*(?=')" lib/data/version.dart)
installerName="SaberInstaller_v${buildName}.exe"
echo "installerName=$installerName" >> $GITHUB_OUTPUT
mv installers/SaberInstaller.exe installers/$installerName
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Saber-Windows
path: installers/${{ steps.rename.outputs.installerName }}
- name: Upload to GitHub release
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: installers/${{ steps.rename.outputs.installerName }}