Garnet Docker images for Windows #582
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@8e1d5461f02b7886d3c1a774bfbd873650445aa2 # was v5 but now v6 with this commit for security reasons have pinned tag (commit SHA) for 3rd party | |
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@327cd5a69de6c009b9ce71bce8395f28e651bf99 # was v3 but now v6 with this commit for security reasons have pinned tag (commit SHA) for 3rd party | |
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] }} |