-
Notifications
You must be signed in to change notification settings - Fork 287
85 lines (77 loc) · 2.69 KB
/
push.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
name: TCA docker image build and push
on:
release:
types: [published]
branches:
- 'main'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./server/projects/main/Dockerfile
context: ./server/projects/main/
image: tca-main
- dockerfile: ./server/projects/analysis/Dockerfile
context: ./server/projects/analysis/
image: tca-analysis
- dockerfile: ./server/projects/login/Dockerfile
context: ./server/projects/login/
image: tca-login
- dockerfile: ./server/projects/file/Dockerfile
context: ./server/projects/file/
image: tca-file
- dockerfile: ./server/projects/scmproxy/Dockerfile
context: ./server/projects/scmproxy/
image: tca-scmproxy
- dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror
context: ./web/tca-deploy-source/
image: tca-web
- dockerfile: ./client/Dockerfile
context: ./client/
image: tca-client
- dockerfile: ./Dockerfile
context: .
image: tca
steps:
# 1. 检出
- name: Check Out
uses: actions/checkout@v2
# 2. 登陆
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# 3. 设置 docker 环境
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# 4. 构建并推送镜像
- name: Build and push with latest tag and release tag
id: docker_build
uses: docker/build-push-action@v2
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }}
if: ${{ github.event_name == 'release' }}
- name: Build and push with beta tag
id: docker_build_beta
uses: docker/build-push-action@v2
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:beta
if: ${{ github.event_name == 'workflow_dispatch' }}
# 5. 打印docker镜像SHA256值
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}