Skip to content

feat: add pwsh

feat: add pwsh #32

Workflow file for this run

name: Docker build and publish
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
build-publish-containers:
name: Build and Publish Containers
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
matrix:
include:
- image: puppet
os: windows-2019
base: ltsc2019
file: dockerfile6
version_match: PUPPET_AGENT_VERSION
- image: puppet
os: windows-2022
base: ltsc2022
file: dockerfile6
version_match: PUPPET_AGENT_VERSION
- image: puppet
os: windows-2019
base: ltsc2019
file: dockerfile8
version_match: PUPPET_AGENT_VERSION
- image: puppet
os: windows-2022
base: ltsc2022
file: dockerfile8
version_match: PUPPET_AGENT_VERSION
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Build
id: build
shell: pwsh
run: |
# dockerd --allow-nondistributable-artifacts docker.io
$checkVersion = Get-Content "$PWD/${{ matrix.image }}/${{ matrix.file }}" | Select-String -Pattern 'ARG ${{ matrix.version_match }}'
if ($checkVersion) {
$version = $checkVersion.ToString().split('=')[-1]
$tag = "jpatigny/${{ matrix.image }}:$($version)-${{ matrix.base }}"
}
else {
$tag = "jpatigny/${{ matrix.image }}:${{ matrix.base }}"
}
Write-Output "tag: $tag"
docker build -f "$PWD/${{ matrix.image }}/${{ matrix.file }}" --build-arg BASE=${{ matrix.base }} -t $tag .
Write-Output "image_tag=$($tag)" >> $Env:GITHUB_OUTPUT
- name: Docker Push
run: |
docker push ${{ steps.build.outputs.image_tag }}