-
Notifications
You must be signed in to change notification settings - Fork 4
101 lines (88 loc) · 3.09 KB
/
docker-publish.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Build & Publish
on:
push:
branches: ['release']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
generate:
runs-on: ubuntu-latest
outputs:
CALVER: ${{ steps.calculate-calver.outputs.calver }}
REGISTRY: ${{ env.REGISTRY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compute outputs
run: |
echo "REGISTRY=${{ env.REGISTRY }}" >> $GITHUB_OUTPUT
- name: Calculate Calver
id: calculate-calver
run: |
calver=$(date +'%Y.%m.%d')
echo "calver=$calver" >> $GITHUB_ENV
echo "::set-output name=calver::$calver"
build_test_images:
runs-on: ubuntu-latest
needs: generate
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile.gatekeeper
tags: |
${{ needs.generate.outputs.REGISTRY }}/keychainmdip/gatekeeper:release
- dockerfile: Dockerfile.keymaster
tags: |
${{ needs.generate.outputs.REGISTRY }}/keychainmdip/keymaster:release
- dockerfile: Dockerfile.hyperswarm
tags: |
${{ needs.generate.outputs.REGISTRY }}/keychainmdip/hyperswarm-mediator:release
- dockerfile: Dockerfile.tess
tags: |
${{ needs.generate.outputs.REGISTRY }}/keychainmdip/tess-mediator:release
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
${{ needs.generate.outputs.CALVER }}
release
- name: Build and push Docker images
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ matrix.tags }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: ${{ matrix.tags }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL'