-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (101 loc) · 3.66 KB
/
Copy pathrelease.yml
File metadata and controls
119 lines (101 loc) · 3.66 KB
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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macOS (and iOS) ship via the Mac App Store / App Store, so no GitHub
# Release artifact is built for them here. Only Windows and Linux, which
# have no app store, are distributed through GitHub Releases.
include:
- os: ubuntu-latest
platform: linux
jobs: linux-deb
- os: windows-latest
platform: windows
jobs: windows-exe
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev binutils libayatana-appindicator3-dev libsystemd-dev
- name: Install Inno Setup (Windows)
if: matrix.platform == 'windows'
run: choco install innosetup --yes --no-progress
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
- name: Add Pub cache to PATH
shell: pwsh
run: |
if ($env:RUNNER_OS -eq "Windows") {
"$env:PUB_CACHE\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
} else {
"$HOME/.pub-cache/bin" | Out-File -FilePath $env:GITHUB_PATH -Append
}
- name: Get dependencies
run: flutter pub get
- name: Distribute ${{ matrix.platform }}
run: flutter_distributor release --name release --jobs ${{ matrix.jobs }}
- name: Smoke test Windows installer
if: matrix.platform == 'windows'
shell: pwsh
run: |
$installer = Get-ChildItem -Path dist -Recurse -Filter *.exe | Select-Object -First 1
if (-not $installer) {
throw "No Windows installer was produced."
}
$installDir = Join-Path $env:RUNNER_TEMP "patterns-smoke"
$installLog = Join-Path $env:RUNNER_TEMP "patterns-install.log"
$installArgs = @(
"/VERYSILENT",
"/SUPPRESSMSGBOXES",
"/NORESTART",
"/DIR=$installDir",
"/LOG=$installLog"
)
$install = Start-Process -FilePath $installer.FullName -ArgumentList $installArgs -Wait -PassThru
if ($install.ExitCode -ne 0) {
if (Test-Path $installLog) {
Get-Content $installLog
}
throw "Installer failed with exit code $($install.ExitCode)."
}
$app = Join-Path $installDir "patterns.exe"
if (-not (Test-Path $app)) {
throw "Installed executable was not found at $app."
}
$process = Start-Process -FilePath $app -WorkingDirectory $installDir -PassThru
Start-Sleep -Seconds 8
if ($process.HasExited) {
throw "Installed app exited during smoke test with code $($process.ExitCode)."
}
Stop-Process -Id $process.Id -Force
- name: Upload packaged artifact
uses: actions/upload-artifact@v4
with:
name: patterns-${{ matrix.platform }}
path: dist/**
- name: Upload binaries to release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
dist/**/*.deb
dist/**/*.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}