-
Notifications
You must be signed in to change notification settings - Fork 134
77 lines (65 loc) · 2.1 KB
/
publish.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
---
name: Publish
on:
push:
branches:
- stable
- mainline
tags:
- v[0-9]+.[0-9]+.[0-9]+
env:
IMAGE_NAME: fholzer/nginx-brotli
jobs:
build-test-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=raw,priority=1000,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=raw,priority=1000,value=mainline-latest,enable=${{ github.ref == 'refs/heads/mainline' }}
type=match,priority=600,pattern=^(v\d+\.\d+\.\d+)$,group=0
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Build amd64 image
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64
push: false
tags: ${{ steps.meta.outputs.tags }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: List images
run: |
docker images
- name: Test
run: |
docker run --rm -v $(pwd)/tests.sh:/tests.sh --entrypoint sh ${{ env.IMAGE_NAME }} /tests.sh
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and publish multi-platform images
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max