-
-
Notifications
You must be signed in to change notification settings - Fork 45
241 lines (218 loc) · 9.11 KB
/
release.yml
File metadata and controls
241 lines (218 loc) · 9.11 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# https://docs.github.com/actions
name: Release
on:
workflow_call:
inputs:
artifact:
required: false
default: true
type: boolean
description: True if analysis must be run against a built artifact
version:
required: true
type: string
description: Upstream app version
jobs:
repository:
name: Repository
runs-on: ubuntu-latest
if: inputs.artifact
permissions:
contents: write
steps:
- name: Retrieve context files
uses: actions/download-artifact@v8
with:
name: context-files
- run: chmod +x bin/* && chmod +x ./*/container-entrypoint.sh
- name: Deploy
uses: peaceiris/actions-gh-pages@v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
publish_branch: dist
enable_jekyll: true
images:
name: Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
artifact-metadata: write
strategy:
fail-fast: false
matrix:
variant:
- apache
- fpm
- fpm-alpine
# platform:
# - linux/amd64
# - linux/arm64
# - linux/arm/v7
# # - linux/arm/v6
# - linux/arm/v5
# - linux/386
# - linux/ppc64le
# - linux/riscv64
# - linux/s390x
# exclude:
# - variant: fpm-alpine
# platform: linux/arm/v5
# include:
# - variant: fpm-alpine
# platform: linux/arm/v6
include:
- variant: apache
platform: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v5,linux/386,linux/ppc64le,linux/riscv64,linux/s390x
- variant: fpm
platform: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v5,linux/386,linux/ppc64le,linux/riscv64,linux/s390x
- variant: fpm-alpine
platform: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386,linux/ppc64le,linux/riscv64,linux/s390x
steps:
- name: Retrieve context files
uses: actions/download-artifact@v8
with:
name: context-files
- run: chmod +x ./*/container-entrypoint.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Container Registry
uses: docker/login-action@v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Retrieve image artifact
uses: actions/download-artifact@v8
if: inputs.artifact
# if: ${{ inputs.artifact && matrix.platform == 'linux/amd64' }}
with:
name: ${{ matrix.variant }}-image
- name: Load artifact image
if: inputs.artifact
# if: ${{ inputs.artifact && matrix.platform == 'linux/amd64' }}
run: docker load -i container-image.tar
- name: Docker meta
uses: docker/metadata-action@v6
id: meta
with:
images: ghcr.io/${{ vars.REGISTRY_IMAGE }}
flavor: |
latest=${{ matrix.variant == 'apache' }}
prefix=
suffix=
tags: |
# variant generic
type=semver,suffix=-${{ matrix.variant }},pattern={{version}},priority=900,value=${{ inputs.version }}
type=semver,suffix=-${{ matrix.variant }},pattern={{major}}.{{minor}},priority=800,value=${{ inputs.version }}
type=semver,suffix=-${{ matrix.variant }},pattern={{major}},priority=700,value=${{ inputs.version }}
type=raw,priority=600,value=${{ matrix.variant }}
# apache specific
type=semver,enable=${{ matrix.variant == 'apache' }},pattern={{version}},priority=500,value=${{ inputs.version }}
type=semver,enable=${{ matrix.variant == 'apache' }},pattern={{major}}.{{minor}},priority=400,value=${{ inputs.version }}
type=semver,enable=${{ matrix.variant == 'apache' }},pattern={{major}},priority=300,value=${{ inputs.version }}
- name: Docker build and push
uses: docker/build-push-action@v7
id: build
with:
context: ./${{ matrix.variant }}/
platforms: ${{ matrix.platform }}
labels: |
org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
org.opencontainers.image.source=https://github.com/${{ vars.REGISTRY_IMAGE }}
org.opencontainers.image.version=${{ inputs.version }}
org.opencontainers.image.title=YOURLS
org.opencontainers.image.description=Your Own URL Shortener
org.opencontainers.image.url=https://yourls.org
org.opencontainers.image.documentation=https://yourls.org
org.opencontainers.image.vendor=YOURLS Org
org.opencontainers.image.authors=YOURLS
org.opencontainers.image.licenses=MIT
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/YOURLS/images/main/images/yourls/README.md
io.artifacthub.package.alternative-locations=docker.io/library/yourls
io.artifacthub.package.logo-url=https://yourls.org/images/yourls-logo.svg
outputs: >-
type=image,
name=ghcr.io/${{ vars.REGISTRY_IMAGE }},
name-canonical=true,
annotation-index.org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }},
annotation-index.org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }},
annotation-index.org.opencontainers.image.source=https://github.com/${{ vars.REGISTRY_IMAGE }},
annotation-index.org.opencontainers.image.version=${{ inputs.version }},
annotation-index.org.opencontainers.image.title=YOURLS,
annotation-index.org.opencontainers.image.description=Your Own URL Shortener,
annotation-index.org.opencontainers.image.url=https://yourls.org,
annotation-index.org.opencontainers.image.documentation=https://yourls.org,
annotation-index.org.opencontainers.image.vendor=YOURLS Org,
annotation-index.org.opencontainers.image.authors=YOURLS,
annotation-index.org.opencontainers.image.licenses=MIT,
annotation-index.io.artifacthub.package.readme-url=https://raw.githubusercontent.com/YOURLS/images/main/images/yourls/README.md,
annotation-index.io.artifacthub.package.alternative-locations=docker.io/library/yourls,
annotation-index.io.artifacthub.package.logo-url=https://yourls.org/images/yourls-logo.svg
tags: ${{ steps.meta.outputs.tags }}
# cache-from: type=gha,scope=${{ matrix.variant }},ignore-error=true
# cache-to: type=gha,scope=${{ matrix.variant }},mode=max
push: true
- name: Sign the image with GitHub OIDC
uses: actions/attest@v4
with:
subject-name: ghcr.io/${{ vars.REGISTRY_IMAGE }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
# - name: Export digest
# run: |
# mkdir -p /tmp/digests/${{ matrix.variant }}
# digest="${{ steps.build.outputs.digest }}"
# touch "/tmp/digests/${{ matrix.variant }}/${digest#sha256:}"
# - name: Upload digest
# uses: actions/upload-artifact@v3
# with:
# name: digests
# path: /tmp/digests/*
# if-no-files-found: error
# retention-days: 1
# digest:
# name: Digest
# runs-on: ubuntu-latest
# needs:
# - images
# strategy:
# fail-fast: false
# matrix:
# variant:
# - apache
# - fpm
# - fpm-alpine
# steps:
# - name: Download digests
# uses: actions/download-artifact@v8
# with:
# name: digests
# path: /tmp/digests
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v4
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v6
# with:
# images: ghcr.io/${{ vars.REGISTRY_IMAGE }}
# - name: Login to Container Registry
# uses: docker/login-action@v4.1.0
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Create manifest list and push
# working-directory: /tmp/digests/${{ matrix.variant }}
# run: |
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf 'ghcr.io/${{ vars.REGISTRY_IMAGE }}@sha256:%s ' *)
# - name: Inspect image
# run: |
# docker buildx imagetools inspect ghcr.io/${{ vars.REGISTRY_IMAGE }}:${{ matrix.variant }}