-
Notifications
You must be signed in to change notification settings - Fork 7
73 lines (64 loc) · 1.8 KB
/
release.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
name: goreleaser
on:
push:
tags:
- '*'
jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
name: Docker Build, Tag, Push
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Log in to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
if: startsWith(github.ref, 'refs/heads/master')
run: echo "TAG=latest" >> $GITHUB_ENV
-
if: startsWith(github.ref, 'refs/tags')
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
-
name: build image
uses: docker/build-push-action@v5
with:
context: ./docker
file: ./docker/Dockerfile
build-args: TAG=${{ env.TAG }}
push: false
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ env.TAG }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.TAG }}
- name: trivy image scan
uses: aquasecurity/[email protected]
with:
image-ref: ${{ github.repository }}:latest
exit-code: 0
severity: UNKNOWN,LOW,MEDIUM
-
name: push image
uses: docker/build-push-action@v5
with:
context: ./docker
file: ./docker/Dockerfile
build-args: TAG=${{ env.TAG }}
push: true
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ env.TAG }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.TAG }}