-
Notifications
You must be signed in to change notification settings - Fork 5
39 lines (37 loc) · 1.13 KB
/
docker-build.yaml
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
name: docker-build
on:
push:
branches:
- main
tags:
- v*
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-qemu-action@v2
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v4
id: meta
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=edge,branch=main
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=pr
flavor: latest=auto
- uses: actions/checkout@v4
- uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
cache-to: type=gha,scope=docker
cache-from: type=gha,scope=docker,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}