|
1 | 1 | name: NanoServer MSVC
|
2 | 2 |
|
3 |
| -on: [push, workflow_dispatch] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + schedule: |
| 8 | + - cron: '0 0 * * *' |
| 9 | + workflow_dispatch: |
4 | 10 |
|
5 | 11 | jobs:
|
6 | 12 | run-nanoserver-msvc-winsdk-x64-build:
|
7 | 13 | runs-on: windows-latest
|
8 | 14 | steps:
|
9 | 15 | - name: Checkout Repository
|
10 | 16 | 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 |
20 | 19 | 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 |
22 | 21 |
|
23 |
| - - name: Run container |
| 22 | + - name: GHA Cache Check |
24 | 23 | shell: pwsh
|
25 | 24 | 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 } |
29 | 29 |
|
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 . |
33 | 36 |
|
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