Skip to content

Commit 964c1b2

Browse files
committed
feat(ci): add PR Docker build workflow for ghcr.io
1 parent 331410d commit 964c1b2

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Docker Build PR
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- "**.md"
7+
branches:
8+
- "**"
9+
10+
jobs:
11+
build-docker-image:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
- uses: actions/checkout@v5
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: latest
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
cache: "pnpm"
26+
- run: pnpm install
27+
- run: pnpm build && ./localizefonts.sh && mv dist/ dist-ci/
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
with:
31+
platforms: all
32+
- name: Set up Docker Buildx
33+
id: buildx
34+
uses: docker/setup-buildx-action@v3
35+
with:
36+
version: latest
37+
- name: Login to GitHub Container Registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Extract metadata
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ghcr.io/${{ github.repository }}
48+
tags: |
49+
type=ref,event=pr
50+
type=ref,event=branch
51+
- name: Build and push
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: .
55+
file: ./Dockerfile.ci
56+
platforms: linux/amd64,linux/arm64
57+
push: true
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)