Skip to content

Commit a6b20be

Browse files
authored
Update main.yml
1 parent 4c75428 commit a6b20be

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
name: NanoServer MSVC
22

3-
on: [push, workflow_dispatch]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: '0 0 * * *'
9+
workflow_dispatch:
410

511
jobs:
612
run-nanoserver-msvc-winsdk-x64-build:
713
runs-on: windows-latest
814
steps:
915
- name: Checkout Repository
1016
uses: actions/checkout@v4
11-
12-
- name: Setup Developer Command Prompt
13-
uses: ilammy/msvc-dev-cmd@release/v1
14-
with:
15-
arch: x64
16-
sdk: 10.0.22621.0
17-
18-
- name: Build Dockerfile (default build-args)
19-
shell: pwsh
17+
18+
- name: Download BuildKit
2019
run: |
21-
docker build -t nanoserver-msvc-winsdk .
20+
curl -SL --output buildx.exe https://github.com/docker/buildx/releases/download/v0.22.0-rc1/buildx-v0.22.0-rc1.windows-amd64.exe
2221
23-
- name: Run container
22+
- name: GHA Cache Check
2423
shell: pwsh
2524
run: |
26-
function Remove-Trailing-Backslash($path) {
27-
return $path -replace '\\$', ''
28-
}
25+
$env:DOCKER_BUILDKIT=1
26+
$env:BUILDX_EXPERIMENTAL=1
27+
.\buildx.exe build -f docker/xcache.dockerfile --cache-to type=gha --cache-from type=gha -t app:latest .
28+
if ($LASTEXITCODE -ne 0) { exit 0 }
2929
30-
$repoWorkspace = Remove-Trailing-Backslash("${{ github.workspace }}")
31-
$vctoolsPath = Remove-Trailing-Backslash($env:VCToolsInstallDir)
32-
$windowsSdkPath = Remove-Trailing-Backslash($env:WindowsSdkDir)
30+
- name: Build Image
31+
shell: pwsh
32+
run: |
33+
$env:DOCKER_BUILDKIT=0
34+
$env:BUILDX_EXPERIMENTAL=0
35+
docker build -f docker/mount.dockerfile -t app:latest .
3336
34-
Write-Host "Source Path: $repoWorkspace"
35-
Write-Host "MSVC Path: $vctoolsPath"
36-
Write-Host "Windows SDK Path: $windowsSdkPath"
37-
38-
docker run --rm -dit --name orphan `
39-
-v "$repoWorkspace:C:\mount\source" `
40-
-v "$vctoolsPath:C:\mount\msvc" `
41-
-v "$windowsSdkPath:C:\mount\windowssdk" `
42-
nanoserver-msvc-winsdk cmd
37+
- name: Cache Image with GHA
38+
shell: pwsh
39+
run: |
40+
$env:DOCKER_BUILDKIT=1
41+
$env:BUILDX_EXPERIMENTAL=1
42+
.\buildx.exe build -f docker/xcache.dockerfile --cache-to type=gha --cache-from type=gha -t app:latest .

0 commit comments

Comments
 (0)