7
7
push :
8
8
branches :
9
9
- main
10
+ release :
11
+ types : [created,published] # 表示在创建新的 Release 时触发
10
12
11
13
# Allows you to run this workflow manually from the Actions tab
12
14
# 可以手动触发
@@ -24,38 +26,35 @@ jobs:
24
26
runs-on : ubuntu-latest
25
27
steps :
26
28
- name : Checkout
27
- uses : actions/checkout@v2
29
+ uses : actions/checkout@v3
28
30
29
- - name : Get current date
30
- id : date
31
- run : echo "::set-output name=today::$(date +'%Y-%m-%d_%H-%M')"
31
+ - name : Inject slug/short variables
32
+ uses : rlespinasse/github-slug-action@v4
32
33
33
34
- name : Set up QEMU
34
- uses : docker/setup-qemu-action@v1
35
+ uses : docker/setup-qemu-action@v2
35
36
36
37
- name : Set up Docker Buildx
37
38
id : buildx
38
- uses : docker/setup-buildx-action@v1
39
+ uses : docker/setup-buildx-action@v2
39
40
40
41
- name : Available platforms
41
42
run : echo ${{ steps.buildx.outputs.platforms }}
42
43
43
44
- name : Login to DockerHub
44
- uses : docker/login-action@v1
45
+ uses : docker/login-action@v2
45
46
with :
46
47
username : ${{ secrets.DOCKERHUB_USERNAME }}
47
48
password : ${{ secrets.DOCKERHUB_TOKEN }}
48
49
49
50
- name : Build and push
50
- uses : docker/build-push-action@v2
51
+ uses : docker/build-push-action@v4
51
52
with :
52
53
context : .
53
54
file : ./Dockerfile
54
55
# 所需要的体系结构,可以在 Available platforms 步骤中获取所有的可用架构
55
- platforms : linux/amd64,linux/arm64/v8
56
- # 镜像推送时间
57
- push : ${{ github.event_name != 'pull_request' }}
56
+ platforms : linux/arm64,linux/amd64
58
57
# 给清单打上多个标签
59
58
tags : |
60
- eryajf/go-ldap-admin-server: ${{ steps.date.outputs.today }}
61
- eryajf/go-ldap-admin-server:latest
59
+ ${{ secrets.DOCKERHUB_USERNAME }}/ ${{ env.GITHUB_REPOSITORY_NAME_PART }}:latest
60
+ ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.GITHUB_REPOSITORY_NAME_PART }}:${{ env.GITHUB_REF_NAME }}
0 commit comments