Skip to content

Commit bd40200

Browse files
committed
ci: add github workflow for publishing container images
Publish multiarch container images of the reference plugins at ghcr.io/containerd/nri/plugins/<plugin>:<tag> The tag is the git tag name for tagged versions and "unstable" for the main branch. The default-validator, network-device-injector and network-logger plugins are skipped in the config as they are also missing from the Makefile.
1 parent 479de9e commit bd40200

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/images.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish Container Images
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v[0-9]+.[0-9]+.[0-9]+
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
jobs:
19+
build-and-push:
20+
name: Build and Push (${{ matrix.image }})
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
image: [
25+
#default-validator,
26+
device-injector,
27+
differ,
28+
hook-injector,
29+
logger,
30+
#network-device-injector,
31+
#network-logger,
32+
template,
33+
ulimit-adjuster,
34+
v010-adapter,
35+
wasm,
36+
]
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Log in to registry
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Determine image tag name
53+
id: tag
54+
run: |
55+
if [ "${{ github.ref_type }}" = "tag" ]; then
56+
tag="${{ github.ref_name }}"
57+
else
58+
case "${{ github.ref_name }}" in
59+
main)
60+
tag="unstable"
61+
;;
62+
esac
63+
fi
64+
if [ -z "$tag" ]; then
65+
echo "ERROR: failed to determine image tag"
66+
exit 1
67+
fi
68+
echo "TAG_NAME=$tag" >> $GITHUB_ENV
69+
70+
- name: Build and push image
71+
uses: docker/build-push-action@v5
72+
with:
73+
context: .
74+
file: ./plugins/Dockerfile
75+
build-args: |
76+
PLUGIN=${{ matrix.image }}
77+
push: true
78+
platforms: linux/amd64,linux/arm64
79+
tags: ghcr.io/${{ github.repository }}/plugins/${{ matrix.image }}:${{ env.TAG_NAME }}
80+

0 commit comments

Comments
 (0)