Repository navigation
69 lines (61 loc) · 1.86 KB
/
Copy pathdocker.yml
File metadata and controls
69 lines (61 loc) · 1.86 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
name: Docker
on:
pull_request:
paths:
- Dockerfile
- .dockerignore
- docker/**
- .github/workflows/docker.yml
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
- packages/*/package.json
# A main build seeds the layer cache a release run can read.
push:
branches: [main]
paths:
- Dockerfile
- .dockerignore
- docker/**
- .github/workflows/docker.yml
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
- packages/*/package.json
release:
types: [published]
concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
# GitHub's pre-release flag only guards the desktop updater, so a plain semver tag still gets latest.
- uses: docker/metadata-action@v6
id: meta
with:
images: ghcr.io/u8array/zplab
tags: type=semver,pattern={{version}}
- uses: docker/login-action@v4
if: github.event_name == 'release'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v7
with:
context: .
# Both arches only for the push, because a pull request just proves the build.
platforms: ${{ github.event_name == 'release' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max