Windows runner image #3
Workflow file for this run
This file contains 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: Windows Containers | |
on: | |
# This Workflow can be triggered manually | |
workflow_dispatch: | |
# Build container images on a daily schedule | |
schedule: | |
- cron: "11 5 * * *" | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Let's also build & tag Spack containers on releases. | |
release: | |
types: [published] | |
concurrency: | |
group: ci-${{github.ref}}-${{github.event.pull_request.number || github.run_number}} | |
cancel-in-progress: true | |
jobs: | |
deploy-windows-images: | |
timeout-minutes: 600 | |
runs-on: windows-2022 | |
permissions: | |
packages: write | |
strategy: | |
# Even if one container fails to build we still want the others | |
# to continue their builds. | |
fail-fast: false | |
matrix: | |
dockerfile: [ | |
# { | |
# name: "windows-servercore1809", | |
# path: "windows-servercore1809.dockerfile", | |
# }, | |
{ | |
name: "windows-servercore21H2", | |
path: "windows-servercore21H2.dockerfile", | |
}, | |
] | |
name: Build ${{ matrix.dockerfile.name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set Container Tag | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# images: ghcr.io/spack/${{ matrix.dockerfile.name }} | |
images: ghcr.io/AlmightyYakob/${{ matrix.dockerfile.name }} | |
tags: | | |
# Tag for PR | |
type=ref,event=branch | |
# Tag for sha | |
type=sha | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# I can not figure out how to make this command multiline in windows | |
# Also the `--label` is omiited, since that breaks the syntax, and for some reason the `--cache-to` argument isn't recognized | |
- name: Docker Build | |
# run: docker build -f Dockerfiles/${{ matrix.dockerfile.path }} --platform windows/amd64 -t ${{ steps.meta.outputs.tags }} --label ${{ steps.meta.outputs.labels }} --cache-from type=registry,ref=ghcr.io/spack/${{ matrix.dockerfile.name }}:nightly --cache-from type=registry,ref=ghcr.io/spack/${{ matrix.dockerfile.name }}:main --cache-from type=registry,ref=ghcr.io/spack/${{ matrix.dockerfile.name }}:latest --cache-to type=inline . | |
run: docker build -f Dockerfiles/${{ matrix.dockerfile.path }} --platform windows/amd64 -t ${{ steps.meta.outputs.tags }} --cache-from type=registry,ref=ghcr.io/spack/${{ matrix.dockerfile.name }}:nightly --cache-from type=registry,ref=ghcr.io/spack/${{ matrix.dockerfile.name }}:main --cache-from type=registry,ref=ghcr.io/spack/${{ matrix.dockerfile.name }}:latest . | |
- name: Docker Push | |
run: docker push ${{ steps.meta.outputs.tags }} |