-
Notifications
You must be signed in to change notification settings - Fork 205
59 lines (49 loc) · 1.54 KB
/
Copy pathRelease_docker_image.yml
File metadata and controls
59 lines (49 loc) · 1.54 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
name: 自动构建并发布 Docker 镜像
on:
release:
types: [ published ]
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
REGISTRY: ghcr.io
DOCKER_REPO: ${{ secrets.DOCKERHUB_USERNAME }}/ks-downloader
GHCR_REPO: ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/ks-downloader
jobs:
publish-docker:
runs-on: ubuntu-latest
steps:
- name: 拉取源码
uses: actions/checkout@v7
with:
fetch-depth: 1
- name: 设置 QEMU
uses: docker/setup-qemu-action@v4
- name: 设置 Docker Buildx
uses: docker/setup-buildx-action@v4
- name: 登录到 Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 登录到 GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 构建和推送 Docker 镜像到 Docker Hub 和 GHCR
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
${{ env.DOCKER_REPO }}:${{ github.event.release.tag_name }}
${{ env.DOCKER_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.event.release.tag_name }}
${{ env.GHCR_REPO }}:latest
provenance: false
sbom: false