Skip to content

Commit 37638bb

Browse files
committed
update main github action
1 parent 07da469 commit 37638bb

1 file changed

Lines changed: 140 additions & 122 deletions

File tree

.github/workflows/main.yml

Lines changed: 140 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,175 @@
1-
name: Windows Release Builder
1+
name: Windows Release Builder
22

33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
tags:
8-
- v**
8+
- v**
99
pull_request:
1010

1111
jobs:
1212
xaml-lint:
1313
runs-on: windows-latest
14+
permissions:
15+
contents: read
1416
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v6
17+
- name: Checkout
18+
uses: actions/checkout@v7
1719

18-
- name: Setup dotnet
19-
uses: actions/setup-dotnet@v5
20-
with:
21-
dotnet-version: '10.x'
20+
- name: Install the .NET workload
21+
uses: actions/setup-dotnet@v6
22+
with:
23+
dotnet-version: '10.x'
2224

23-
- name: Restore dotnet tools
24-
run: dotnet tool restore
25+
- name: Restore .NET tools
26+
run: dotnet tool restore
2527

26-
- name: Lint XAML files
27-
run: .\scripts\lint-xaml.ps1
28+
- name: Run XAML style check
29+
run: .\scripts\lint-xaml.ps1
2830

2931
test:
3032
runs-on: windows-latest
33+
permissions:
34+
contents: read
3135
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v6
36+
- name: Checkout
37+
uses: actions/checkout@v7
3438

35-
- name: Setup MSBuild.exe
36-
uses: microsoft/setup-msbuild@v3
39+
- name: Add MSBuild to PATH
40+
uses: microsoft/setup-msbuild@v3
3741

38-
- uses: actions/cache@v6
39-
with:
40-
path: ~\.nuget\packages
41-
key: ${{ runner.os }}-nuget-test-${{ hashFiles('**/*.csproj') }}
42-
restore-keys: |
42+
- uses: actions/cache@v6
43+
with:
44+
path: ~\.nuget\packages
45+
key: ${{ runner.os }}-nuget-test-${{ hashFiles('**/*.csproj') }}
46+
restore-keys: |
4347
${{ runner.os }}-nuget-test-
4448

45-
- name: Build tests
46-
run: msbuild Screenbox.Core.Tests\Screenbox.Core.Tests.csproj -p:Configuration=Release -p:Platform=x64 -p:OutDir=C:\BuildOutput\ -restore
49+
- name: Build tests
50+
run: msbuild Screenbox.Core.Tests\Screenbox.Core.Tests.csproj -p:Configuration=Release -p:Platform=x64 -p:OutDir=C:\BuildOutput\ -restore
4751

48-
- name: Run tests
49-
run: C:\BuildOutput\Screenbox.Core.Tests.exe
52+
- name: Run tests
53+
run: C:\BuildOutput\Screenbox.Core.Tests.exe
5054

5155
build:
5256
runs-on: windows-latest
57+
permissions:
58+
contents: read
59+
actions: write
5360
steps:
54-
- name: Checkout
55-
uses: actions/checkout@v6
56-
57-
- name: Setup MSBuild.exe
58-
uses: microsoft/setup-msbuild@v3
59-
60-
- uses: actions/cache@v6
61-
with:
62-
path: ~\.nuget\packages
63-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
64-
restore-keys: |
61+
- name: Checkout
62+
uses: actions/checkout@v7
63+
64+
- name: Add MSBuild to PATH
65+
uses: microsoft/setup-msbuild@v3
66+
67+
- name: Cache NuGet packages
68+
uses: actions/cache@v6
69+
with:
70+
path: ~\.nuget\packages
71+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
72+
restore-keys: |
6573
${{ runner.os }}-nuget-
6674

67-
- name: Fetch Gomplate
68-
env:
69-
GH_TOKEN: ${{ github.token }}
70-
run: gh release download v5.0.0 --repo hairyhenderson/gomplate --pattern 'gomplate_*amd64.exe' --output .\gomplate.exe
71-
72-
- name: Render secrets
73-
env:
74-
APPCENTER_API_KEY: ${{ github.ref_type == 'tag' && secrets.APPCENTER_API_KEY || '' }}
75-
SENTRY_DSN: ${{ github.ref_type == 'tag' && secrets.SENTRY_DSN || '' }}
76-
run: Get-Content Screenbox/Secrets.cs.template | .\gomplate.exe | Set-Content Screenbox/Secrets.cs
77-
78-
- name: Get tag version
79-
id: get-tag-version
80-
if: github.ref_type == 'tag'
81-
run: |
82-
$found = "${{ github.ref_name }}" -match 'v*(\d+.\d+.\d+)'
83-
if ($found) { $match = $matches[1] }
84-
"version=$match" >> $env:GITHUB_OUTPUT
85-
86-
- name: Update package manifest
87-
run: .\scripts\update-manifest.ps1 -Version "${{ steps.get-tag-version.outputs.version }}"
88-
89-
- name: Build store package
90-
env:
91-
BuildMode: StoreUpload
92-
PackageDir: C:\DeployOutput\
93-
SENTRY_ORG: starpine
94-
SENTRY_PROJECT: screenbox
95-
SENTRY_URL: https://sentry.io/
96-
SENTRY_RELEASE : screenbox@${{ steps.get-tag-version.outputs.version }}
97-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
98-
run: |
99-
if ('${{ github.ref_type }}' -eq 'tag') {
100-
$sentryArgs = "-p:SentryUploadSymbols=true", `
101-
"-p:SentryOrg=$env:SENTRY_ORG", `
102-
"-p:SentryProject=$env:SENTRY_PROJECT", `
103-
"-p:SentryUrl=$env:SENTRY_URL", `
104-
"-p:SentryCreateRelease=true", `
105-
"-p:SentrySetCommits=true"
106-
}
107-
msbuild Screenbox\Screenbox.csproj `
108-
-nologo `
109-
-restore `
110-
-v:minimal `
111-
-p:RestoreConfigFile=nuget.config `
112-
-p:ContinuousIntegrationBuild=true `
113-
-p:Configuration=Release `
114-
-p:Platform=x64 `
115-
-p:UapAppxPackageBuildMode=$env:BuildMode `
116-
-p:AppxPackageDir=$env:PackageDir @sentryArgs
117-
118-
- name: Create store-upload artifact
119-
uses: actions/upload-artifact@v7
120-
if: github.ref_type == 'tag'
121-
with:
122-
name: store-upload
123-
path: |
124-
C:\DeployOutput\*.msixupload
125-
C:\DeployOutput\*.appxupload
126-
127-
- name: Create sideload artifact
128-
uses: actions/upload-artifact@v7
129-
with:
130-
name: Screenbox-sideload
131-
path: |
132-
C:\DeployOutput\*_Test
75+
- name: Fetch Gomplate
76+
env:
77+
GH_TOKEN: ${{ github.token }}
78+
run: gh release download v5.0.0 --repo hairyhenderson/gomplate --pattern 'gomplate_*amd64.exe' --output .\gomplate.exe
79+
80+
- name: Render secrets file
81+
env:
82+
APPCENTER_API_KEY: ${{ github.ref_type == 'tag' && secrets.APPCENTER_API_KEY || '' }}
83+
SENTRY_DSN: ${{ github.ref_type == 'tag' && secrets.SENTRY_DSN || '' }}
84+
run: Get-Content Screenbox/Secrets.cs.template | .\gomplate.exe | Set-Content Screenbox/Secrets.cs
85+
86+
- name: Get tag version
87+
id: get-tag-version
88+
if: github.ref_type == 'tag'
89+
run: |
90+
$found = "${{ github.ref_name }}" -match 'v*(\d+.\d+.\d+)'
91+
if ($found) { $match = $matches[1] }
92+
"version=$match" >> $env:GITHUB_OUTPUT
93+
94+
- name: Update package manifest
95+
run: .\scripts\update-manifest.ps1 -Version "${{ steps.get-tag-version.outputs.version }}"
96+
97+
- name: Build app package
98+
env:
99+
PackageDir: C:\DeployOutput\
100+
SENTRY_ORG: starpine
101+
SENTRY_PROJECT: screenbox
102+
SENTRY_URL: https://sentry.io/
103+
SENTRY_RELEASE : screenbox@${{ steps.get-tag-version.outputs.version }}
104+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
105+
run: |
106+
if ('${{ github.ref_type }}' -eq 'tag') {
107+
$buildMode = "StoreUpload"
108+
$sentryArgs = "-p:SentryUploadSymbols=true", `
109+
"-p:SentryOrg=$env:SENTRY_ORG", `
110+
"-p:SentryProject=$env:SENTRY_PROJECT", `
111+
"-p:SentryUrl=$env:SENTRY_URL", `
112+
"-p:SentryCreateRelease=true", `
113+
"-p:SentrySetCommits=true"
114+
}
115+
else {
116+
$buildMode = "SideloadOnly"
117+
$sentryArgs = @()
118+
}
119+
120+
msbuild Screenbox\Screenbox.csproj `
121+
-nologo `
122+
-restore `
123+
-p:RestoreConfigFile=nuget.config `
124+
-p:ContinuousIntegrationBuild=true `
125+
-p:Configuration=Release `
126+
-p:Platform=x64 `
127+
-p:AppxPackageDir=$env:PackageDir `
128+
-p:UapAppxPackageBuildMode=$buildMode `
129+
@sentryArgs
130+
131+
- name: Upload Store submission package artifact
132+
uses: actions/upload-artifact@v7
133+
if: github.ref_type == 'tag'
134+
with:
135+
name: store-upload
136+
path: |
137+
C:\DeployOutput\*.msixupload
138+
C:\DeployOutput\*.appxupload
139+
140+
- name: Upload sideload artifact
141+
uses: actions/upload-artifact@v7
142+
with:
143+
name: Screenbox-sideload
144+
path: |
145+
C:\DeployOutput\*_Test\*
146+
!C:\DeployOutput\*_Test\*.msix
147+
compression-level: 0
133148

134149
release:
135150
needs: build
136151
if: github.ref_type == 'tag'
137152
runs-on: ubuntu-latest
153+
permissions:
154+
contents: write
155+
actions: read
138156
steps:
139-
- name: Checkout
140-
uses: actions/checkout@v6
141-
142-
- name: Download package
143-
uses: actions/download-artifact@v8
144-
with:
145-
name: Screenbox-sideload
146-
path: download/
147-
148-
- name: Zip artifact
149-
run: zip -r sideload.zip download/
150-
151-
- name: Generate GitHub Release
152-
uses: softprops/action-gh-release@v3
153-
with:
154-
draft: true
155-
generate_release_notes: true
156-
files: |
157-
sideload.zip
157+
- name: Checkout
158+
uses: actions/checkout@v7
159+
160+
- name: Download package
161+
uses: actions/download-artifact@v8
162+
with:
163+
name: Screenbox-sideload
164+
path: download/
165+
166+
- name: Zip artifact
167+
run: zip -r sideload.zip download/
168+
169+
- name: Generate GitHub Release
170+
uses: softprops/action-gh-release@v3
171+
with:
172+
draft: true
173+
generate_release_notes: true
174+
files: |
175+
sideload.zip

0 commit comments

Comments
 (0)