-
-
Notifications
You must be signed in to change notification settings - Fork 20
136 lines (121 loc) · 4.93 KB
/
pwru.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
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
135
name: pwru
on:
push:
branches:
- main
paths:
- pwru/*
- .github/workflows/pwru.yml
workflow_dispatch:
schedule:
- cron: "0 8 * * 1"
env:
BUILD_VERSION: "v1.0.9"
DOCKER_CLI_EXPERIMENTAL: enabled
REPOSITORY: ${{ github.actor }}/${{ github.workflow }}
permissions: read-all
jobs:
deploy:
strategy:
fail-fast: false
matrix:
distro: [ubuntu, alpine]
runs-on: ubuntu-24.04
permissions:
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v1
with:
disable-sudo: true
egress-policy: block
disable-telemetry: true
allowed-endpoints:
api.github.com:443
archive.ubuntu.com:80
auth.docker.io:443
deb.debian.org:80
dl-cdn.alpinelinux.org:443
ghcr.io:443
github.com:443
pkg-containers.githubusercontent.com:443
index.docker.io:443
ports.ubuntu.com:80
production.cloudflare.docker.com:443
proxy.golang.org:443
registry-1.docker.io:443
security.ubuntu.com:80
sum.golang.org:443
- name: Source checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.4.2
- name: Setup QEMU
id: qemu
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v1.2.0
- name: Setup Buildx
id: buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v1
- name: Set Docker metadata
id: docker_meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v3
with:
images: ${{ env.REPOSITORY }}
labels: |
org.opencontainers.image.version=${{ env.BUILD_VERSION }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.title=${{ env.REPOSITORY }}
- name: GitHub login
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v1.12.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: DockerHub login
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v1.12.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push (Ubuntu)
if: ${{ matrix.distro == 'ubuntu' }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v2.8.0
with:
push: ${{ github.event_name != 'pull_request' }}
context: ${{ github.workflow }}
file: ${{ github.workflow }}/Dockerfile
#platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7
platforms: linux/amd64
#platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: BUILD_VERSION
cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.distro }}
cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.distro }}
labels: ${{ steps.docker_meta.outputs.labels }}
tags: |
docker.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}
docker.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}-${{ matrix.distro }}
docker.io/${{ env.REPOSITORY }}:latest
ghcr.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}
ghcr.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}-${{ matrix.distro }}
ghcr.io/${{ env.REPOSITORY }}:latest
- name: Build and push (Alpine)
if: ${{ matrix.distro == 'alpine' }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v2.8.0
with:
push: ${{ github.event_name != 'pull_request' }}
context: ${{ github.workflow }}
file: ${{ github.workflow }}/Dockerfile.${{ matrix.distro }}
#platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7
platforms: linux/amd64
#platforms: linux/amd64,linux/arm64,linux/ppc64le
#platforms: linux/amd64,linux/arm64
#platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le
build-args: |
BUILD_VERSION
sbom: true
provenance: true
cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.distro }}
cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.distro }}
labels: ${{ steps.docker_meta.outputs.labels }}
tags: |
docker.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}-${{ matrix.distro }}
ghcr.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}-${{ matrix.distro }}