Garnet Docker images for Windows #392
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: Garnet Docker images for Windows | |
on: | |
workflow_dispatch: # allow manual run | |
workflow_run: | |
workflows: ['Garnet .NET CI'] | |
types: [completed] | |
branches: [main] | |
push: | |
tags: 'v*' | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
docker: | |
runs-on: windows-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }}-nanoserver-ltsc2022 | |
tags: | | |
# generate Docker tags based on the following events/attributes | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
# set latest tag for default branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
if: github.event_name != 'pull_request' | |
run: | | |
docker build -f Dockerfile.nanoserver ` | |
--tag ${{ fromJSON(steps.meta.outputs.json).tags[0] }} ` | |
--tag ${{ fromJSON(steps.meta.outputs.json).tags[1] }} ` | |
--tag ${{ fromJSON(steps.meta.outputs.json).tags[2] }} . | |
docker push ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | |
docker push ${{ fromJSON(steps.meta.outputs.json).tags[1] }} | |
docker push ${{ fromJSON(steps.meta.outputs.json).tags[2] }} |