Repository navigation
73 lines (61 loc) · 1.96 KB
/
Copy pathnative.yml
File metadata and controls
73 lines (61 loc) · 1.96 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
name: Native CI
on:
push:
branches: [main]
tags: ['v2.*']
pull_request:
branches: [main]
permissions:
contents: read
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v7
- name: Configure
run: cmake --preset msvc-release
- name: Build
run: cmake --build --preset msvc-release --parallel
- name: Test
run: ctest --preset msvc-release
- name: Package and enforce single-file limits
shell: pwsh
run: |
$exe = Get-Item -LiteralPath 'build\msvc-release\Release\DesktopNote.exe'
if ($exe.Length -gt 5MB) {
throw "DesktopNote.exe is $($exe.Length) bytes; limit is 5 MiB"
}
New-Item -ItemType Directory -Path dist -Force | Out-Null
Copy-Item -LiteralPath $exe.FullName -Destination 'dist\DesktopNote.exe'
$files = @(Get-ChildItem -LiteralPath dist -File)
if ($files.Count -ne 1 -or $files[0].Name -ne 'DesktopNote.exe') {
throw 'Release directory must contain exactly DesktopNote.exe'
}
- uses: actions/upload-artifact@v7
with:
name: DesktopNote-win-x64
path: dist/DesktopNote.exe
if-no-files-found: error
release:
if: startsWith(github.ref, 'refs/tags/v2.')
needs: build
runs-on: windows-2022
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: DesktopNote-win-x64
path: dist
- name: Publish v2 release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
$tag = '${{ github.ref_name }}'
if (gh release view $tag 2>$null) {
gh release upload $tag 'dist\DesktopNote.exe#DesktopNote.exe' --clobber
} else {
gh release create $tag 'dist\DesktopNote.exe#DesktopNote.exe' --verify-tag --generate-notes
}