-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (55 loc) · 1.98 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (55 loc) · 1.98 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
name: Release
# 打 v* tag → 构建多架构镜像推 ghcr.io/filescodebox/server
on:
push:
tags: ["v*"]
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/filescodebox/server
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with: { path: server }
- uses: actions/checkout@v4
with: { repository: filescodebox/frontend, path: frontend }
- name: 工作区布局 + ignore 规则
run: |
mkdir -p ${{ github.workspace }}/ws
mv server frontend ${{ github.workspace }}/ws/
printf '*/.git\n**/node_modules\n*/bin\n*/data\n*/logs\ngo.work\ngo.work.sum\n' > ${{ github.workspace }}/ws/.dockerignore
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- uses: docker/build-push-action@v6
with:
context: ${{ github.workspace }}/ws
file: ${{ github.workspace }}/ws/server/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# buildx 默认 provenance 认证清单会使 GitHub Packages 页面渲染 500
# (registry 拉取不受影响,仅 Web UI 坏),关掉保证包页可开、可见性可改
provenance: false
build-args: |
VERSION=${{ github.ref_name }}
COMMIT=${{ github.sha }}
BUILD_TIME=${{ steps.meta.outputs.date }}
GOPROXY=https://proxy.golang.org,direct