-
Notifications
You must be signed in to change notification settings - Fork 4
65 lines (63 loc) · 2.37 KB
/
docker_update_lichen.yml
File metadata and controls
65 lines (63 loc) · 2.37 KB
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
# Anyone with write permissions to the antrea-io/antrea-image-utis Github
# repository can trigger this workflow manually, but please check with a
# maintainer first.
name: Update antrea/lichen Docker image
on:
workflow_dispatch:
inputs:
go-version:
description: 'The Go version to use to build and run lichen'
required: false
default: '' # there is a default version in the Dockerfile
lichen-version:
description: 'The lichen version to install'
required: false
default: '' # there is a default version in the Dockerfile
docker-tag:
description: 'Tag for built Docker image'
required: false
default: 'latest'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check-out code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set docker build args
run: |
args="[]"
if [ "${{ github.event.inputs.go-version }}" != "" ]; then
args=$(echo "$args" | jq '. += ["GO_VERSION=${{ github.event.inputs.go-version }}"]')
fi
if [ "${{ github.event.inputs.lichen-version }}" != "" ]; then
args=$(echo "$args" | jq '. += ["LICHEN_VERSION=${{ github.event.inputs.lichen-version }}"]')
fi
# get the format expected by docker/build-push-action for the build-args input
args=$(echo "$args" | jq -r '.[]')
# multiline env string
# see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "docker_build_args<<$EOF" >> "$GITHUB_ENV"
echo "$args" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: images/lichen
platforms: linux/amd64 # no need for other platforms
build-args: |
${{ env.docker_build_args }}
push: true
tags: antrea/lichen:${{ github.event.inputs.docker-tag }}
no-cache: true