Repository navigation
134 lines (126 loc) · 5.83 KB
/
Copy pathstabledockerimages.yml
File metadata and controls
134 lines (126 loc) · 5.83 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Stable Release to Docker Hub
on:
workflow_dispatch:
permissions: read-all
jobs:
compute-version:
if: github.repository_owner == 'pnp'
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.v.outputs.VERSION }}
steps:
# The images install the module from the PowerShell Gallery, so its latest stable release is the version to publish
- id: v
shell: pwsh
run: |
$version = (Find-Module -Name PnP.PowerShell -Repository PSGallery).Version
"VERSION=$version" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
publish-docker-windows-amd64:
if: github.repository_owner == 'pnp'
runs-on: windows-2025
needs: compute-version
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
- name: Build an image
run: |
$VERSION="${{ needs.compute-version.outputs.VERSION }}"
docker build --build-arg PNP_VERSION=$VERSION --platform windows/amd64 ./docker -f ./docker/windows-amd64.dockerfile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-stable-windows-amd64
- name: Push the image
run: |
$VERSION="${{ needs.compute-version.outputs.VERSION }}"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-stable-windows-amd64"
publish-docker-linux-arm32v7:
if: github.repository_owner == 'pnp'
runs-on: ubuntu-latest
needs: compute-version
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
# Buildx emulates arm32 on the x64 runner; the image installs the module each time a container starts
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build & push the image
uses: docker/build-push-action@v7
with:
context: ./docker
file: ./docker/linux-arm32.dockerfile
platforms: linux/arm/v7
push: true
tags: ${{ secrets.DOCKER_ORG }}/powershell:${{ needs.compute-version.outputs.VERSION }}-stable-linux-arm32v7
build-args: |
PNP_VERSION=${{ needs.compute-version.outputs.VERSION }}
# Without attestations the tag is a single image manifest, which docker manifest create can amend
provenance: false
sbom: false
publish-docker-linux-arm64:
if: github.repository_owner == 'pnp'
runs-on: ubuntu-24.04-arm
needs: compute-version
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
- name: Build an image
run: |
VERSION="${{ needs.compute-version.outputs.VERSION }}"
docker build --build-arg PNP_VERSION=$VERSION --platform linux/arm64/v8 ./docker -f ./docker/linux-arm64.dockerfile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-stable-linux-arm64
- name: Push the image
run: |
VERSION="${{ needs.compute-version.outputs.VERSION }}"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-stable-linux-arm64"
publish-docker-linux-amd64:
if: github.repository_owner == 'pnp'
runs-on: ubuntu-latest
needs: compute-version
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
- name: Build an image
run: |
VERSION="${{ needs.compute-version.outputs.VERSION }}"
docker build --build-arg PNP_VERSION=$VERSION --platform linux/amd64 ./docker -f ./docker/linux-amd64.dockerfile --tag ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-stable-linux-amd64
- name: Push the image
run: |
VERSION="${{ needs.compute-version.outputs.VERSION }}"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker push "${{ secrets.DOCKER_ORG }}/powershell:$VERSION-stable-linux-amd64"
publish-docker-manifest:
if: github.repository_owner == 'pnp'
runs-on: ubuntu-latest
needs: [ compute-version, publish-docker-linux-arm32v7, publish-docker-linux-arm64, publish-docker-linux-amd64, publish-docker-windows-amd64 ]
steps:
- name: Publish manifest
run: |
VERSION="${{ needs.compute-version.outputs.VERSION }}-stable"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p '${{ secrets.DOCKER_PASSWORD }}'
docker manifest create ${{ secrets.DOCKER_ORG }}/powershell:$VERSION \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-amd64 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-arm32v7 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-arm64 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-windows-amd64
docker manifest push ${{ secrets.DOCKER_ORG }}/powershell:$VERSION
docker manifest create ${{ secrets.DOCKER_ORG }}/powershell:stable \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-amd64 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-arm32v7 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-arm64 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-windows-amd64
docker manifest push ${{ secrets.DOCKER_ORG }}/powershell:stable
docker manifest create ${{ secrets.DOCKER_ORG }}/powershell:latest \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-amd64 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-arm32v7 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-linux-arm64 \
--amend ${{ secrets.DOCKER_ORG }}/powershell:$VERSION-windows-amd64
docker manifest push ${{ secrets.DOCKER_ORG }}/powershell:latest