Skip to content

Commit ba397a6

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 and wasm plugins are skipped in the config. The default-validator plugin is not runnable as an external plugin and the wasm plugin cannot be run from a container. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
1 parent 7addf3f commit ba397a6

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/images.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
device-injector,
26+
differ,
27+
hook-injector,
28+
logger,
29+
network-device-injector,
30+
network-logger,
31+
template,
32+
ulimit-adjuster,
33+
v010-adapter,
34+
]
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Log in to registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ghcr.io
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Determine image tag name
51+
id: tag
52+
run: |
53+
if [ "${{ github.ref_type }}" = "tag" ]; then
54+
tag="${{ github.ref_name }}"
55+
else
56+
case "${{ github.ref_name }}" in
57+
main)
58+
tag="unstable"
59+
;;
60+
esac
61+
fi
62+
if [ -z "$tag" ]; then
63+
echo "ERROR: failed to determine image tag"
64+
exit 1
65+
fi
66+
echo "TAG_NAME=$tag" >> $GITHUB_ENV
67+
68+
- name: Build and push image
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
file: ./plugins/Dockerfile
73+
build-args: |
74+
PLUGIN=${{ matrix.image }}
75+
push: true
76+
platforms: linux/amd64,linux/arm64
77+
tags: ghcr.io/${{ github.repository }}/plugins/${{ matrix.image }}:${{ env.TAG_NAME }}

0 commit comments

Comments
 (0)