-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (66 loc) · 1.98 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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: 4
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 }}