Update main.yml #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: NanoServer MSVC | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
run-nanoserver-msvc-winsdk-x64-build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Restore Cached Image TAR | |
uses: actions/cache@v4 | |
with: | |
path: cache-image.tar | |
key: docker-image-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
docker-image-${{ runner.os }}- | |
- name: Load Cached Image | |
shell: pwsh | |
id: load_cache | |
run: | | |
if (Test-Path cache-image.tar) { | |
docker load -i cache-image.tar | |
echo "CACHE_HIT=true" >> $env:GITHUB_ENV | |
} | |
- name: Build Image Without Cache | |
if: env.CACHE_HIT != 'true' | |
shell: pwsh | |
run: | | |
docker build -t app:latest . | |
- name: Save Docker Image to TAR | |
if: env.CACHE_HIT != 'true' | |
shell: pwsh | |
run: | | |
docker save -o cache-image.tar app:latest | |
- name: Cache Image TAR | |
if: env.CACHE_HIT != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: cache-image.tar | |
key: docker-image-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
docker-image-${{ runner.os }}- |