-
Notifications
You must be signed in to change notification settings - Fork 568
87 lines (85 loc) · 3.58 KB
/
Publish Package.yml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Publish Latest Package
on:
workflow_dispatch: {}
push:
paths-ignore:
- 'docs/**'
- '.github/**'
- '**.md'
- '**.png'
- '**.json'
branches: [master]
tags: ["*"]
jobs:
build:
runs-on: ubuntu-latest
name: Publish Latest Package job
if: startsWith(github.repository, 'qd-today/qd') # 仓库名
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.GITHUB_TOKEN }} # dockerServer Token
- name: login to qdtoday DockerHub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.QD_DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=QD_DOCKER_USERNAME value=dockerid
password: ${{ secrets.QD_DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=QD_DOCKER_PASSWORD value=dockerToken
- name: Publish Latest Package
uses: docker/build-push-action@v4
if: github.ref == 'refs/heads/master'
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7 # 你准备构建的镜像平台
push: true
tags: ghcr.io/qd-today/qd:latest,docker.io/qdtoday/qd:dev
- name: Login to a76yyyy DockerHub
uses: docker/login-action@v2
if: github.ref == 'refs/heads/master'
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=DOCKER_PASSWORD value=dockerToken
- name: Push image to a76yyyy DockerHub
if: github.ref == 'refs/heads/master'
run: |
docker buildx imagetools create \
--tag docker.io/a76yyyy/qiandao:dev \
docker.io/qdtoday/qd:dev
- name: Get version
id: get_version
if: startsWith(github.ref, 'refs/tags/')
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build Latest Package
uses: docker/build-push-action@v4
if: startsWith(github.ref, 'refs/tags/')
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7 # 你准备构建的镜像平台
push: true
tags: docker.io/qdtoday/qd:latest,docker.io/qdtoday/qd:${{ steps.get_version.outputs.VERSION }}
- name: Login to a76yyyy DockerHub
uses: docker/login-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=DOCKER_PASSWORD value=dockerToken
- name: Push image to a76yyyy DockerHub
if: startsWith(github.ref, 'refs/tags/')
run: |
docker buildx imagetools create \
--tag docker.io/a76yyyy/qiandao:latest \
--tag docker.io/a76yyyy/qiandao:${{ steps.get_version.outputs.VERSION }} \
docker.io/qdtoday/qd:${{ steps.get_version.outputs.VERSION }}