-
Notifications
You must be signed in to change notification settings - Fork 19
66 lines (54 loc) · 1.81 KB
/
docker-ci.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
name: k5web-docker-ci
on: [push, pull_request]
env:
PLATFORMS: linux/amd64
TAG: latest
permissions:
packages: write
jobs:
main:
strategy:
fail-fast: false
matrix:
configuration: [Release]
file: [Dockerfile]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.7
with:
show-progress: false
submodules: recursive
- name: Login to ghcr.io
uses: docker/login-action@v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.3.0
- name: Prepare environment outputs
shell: sh
run: |
set -eu
echo "DATE_ISO8601=$(date --iso-8601=seconds --utc)" >> "$GITHUB_ENV"
echo "FIXED_TAG=$(echo ${{ github.ref }} | cut -d '/' -f 3)" >> "$GITHUB_ENV"
echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV
- name: Build ${{ matrix.configuration }} Docker image from ${{ matrix.file }}
uses: docker/build-push-action@v6.0.0
with:
build-args: CONFIGURATION=${{ matrix.configuration }}
context: .
file: ${{ matrix.file }}
platforms: ${{ env.PLATFORMS }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}
org.opencontainers.image.version=${{ env.FIXED_TAG }}
org.opencontainers.image.revision=${{ github.sha }}
tags: |
ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.SHORT_SHA }}
ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.TAG }}
provenance: true
sbom: true
push: true