-
Notifications
You must be signed in to change notification settings - Fork 22
155 lines (128 loc) · 6.03 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
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
name: Windows Release
on:
workflow_dispatch:
jobs:
version:
runs-on: windows-latest
permissions:
contents: read
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/[email protected]
- name: Extract Version from pubspec.yaml
id: extract_version
run: |
$VERSION = Select-String -Path ".\pubspec.yaml" -Pattern "^\s*version:\s*(\d+\.\d+\.\d+)" -CaseSensitive | ForEach-Object{ $_.Matches.Groups[1].Value }
echo version=$VERSION >> $env:GITHUB_OUTPUT
Build-windows:
runs-on: windows-latest
permissions:
contents: read
needs: version
steps:
- uses: actions/[email protected]
- name: Replace iss placeholders
run: |
$outputDir = "${{ github.workspace }}"
$setupIconFile = "${{ github.workspace }}\assets\icons\logo.ico"
$baseDir = "${{ github.workspace }}"
$briskVersion = "${{ needs.version.outputs.version }}"
$outputBaseFileName = "Brisk-v${{ needs.version.outputs.version }}-windows-x86_64"
(Get-Content windows/packaging/exe/inno.iss) -replace 'OUTPUT_DIR', $outputDir | Set-Content windows/packaging/exe/inno.iss
(Get-Content windows/packaging/exe/inno.iss) -replace 'BRISK_VERSION', $briskVersion | Set-Content windows/packaging/exe/inno.iss
(Get-Content windows/packaging/exe/inno.iss) -replace 'SETUP_ICON_FILE', $setupIconFile | Set-Content windows/packaging/exe/inno.iss
(Get-Content windows/packaging/exe/inno.iss) -replace 'BASE_DIR', $baseDir | Set-Content windows/packaging/exe/inno.iss
(Get-Content windows/packaging/exe/inno.iss) -replace 'EXE_NAME', $exeName | Set-Content windows/packaging/exe/inno.iss
(Get-Content windows/packaging/exe/inno.iss) -replace 'OUTPUT_BASE_FILE_NAME', $outputBaseFileName | Set-Content windows/packaging/exe/inno.iss
- name: Display Inno Setup File Content
shell: pwsh
run: |
Get-Content "windows/packaging/exe/inno.iss" | ForEach-Object { Write-Output $_ }
Write-Output "End of inno.iss content."
- name: Install flutter
uses: subosito/[email protected]
with:
flutter-version: "3.22.0"
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
architecture: x64
- name: Install project dependencies
run: |
flutter pub get
dart pub global activate flutter_distributor
choco install innosetup --yes
echo "Inno Setup installed."
- name: Generate intermediates
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Set proper icon path
run: |
$iconPath = "${{ github.workspace }}\\assets\\icons\\logo.ico"
(Get-Content windows/packaging/exe/make_config.yaml) -replace 'PLACEHOLDER_ICON_PATH', $iconPath | Set-Content windows/packaging/exe/make_config.yaml
- name: Enable windows build
run: flutter config --enable-windows-desktop
- name: Build Brisk
run: flutter build windows
- name: Build Brisk Auto Updater
run: flutter build windows --release
working-directory: brisk_auto_updater
- name: Zip the build output
run: |
$mainAppPath = "${{ github.workspace }}\build\windows\x64\runner\Release"
$updaterPath = "${{ github.workspace }}\brisk_auto_updater\build\windows\x64\runner\Release"
$zipFileName = "${{ github.workspace }}\Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.zip"
$updaterAppPath = "$mainAppPath\updater"
mkdir $updaterAppPath
# Copy updater application including the data folder
Copy-Item -Path "$updaterPath\*" -Destination "$updaterAppPath" -Recurse
# Copy data folder as a whole to avoid merging its contents
# $dataFolderPath = "${{ github.workspace }}\brisk_auto_updater\build\windows\x64\runner\Release\data"
# Copy-Item -Path $dataFolderPath -Destination "$updaterDest" -Recurse
# Create the zip archive
Compress-Archive -Path "$mainAppPath\*" -DestinationPath "$zipFileName" -Force
- name: Create Installer with Inno Setup
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "${{ github.workspace }}\windows\packaging\exe\inno.iss"
- name: Raname exe file
run: Rename-Item -Path "${{ github.workspace }}\Brisk.exe" -NewName "Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe"
- name: Upload artifact
uses: actions/[email protected]
with:
name: brisk-windows-exe
path: Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe
retention-days: 1
- name: Upload artifact
uses: actions/[email protected]
with:
name: brisk-windows-zip
path: Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.zip
retention-days: 1
Release:
runs-on: ubuntu-latest
needs: [Build-windows, version]
permissions:
contents: write
steps:
- name: Checkout the code
uses: actions/[email protected]
- name: Donwload artifact package
uses: actions/[email protected]
with:
name: brisk-windows-exe
- name: Donwload artifact package
uses: actions/[email protected]
with:
name: brisk-windows-zip
- name: Release the changes
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.version.outputs.version }}
body_path: ./.github/release.md
#body: ${{ inputs.Release_note }}
files: |
./Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.zip
./Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe