forked from kagenti/plugins-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 2.99 KB
/
build.yaml
File metadata and controls
91 lines (77 loc) · 2.99 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
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
name: Build-Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
plugin_deps:
description: 'Plugin dependencies to include (comma-separated, e.g., "nemocheck" or "nemo,nemocheck")'
required: false
default: 'nemocheck'
permissions: {}
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
- name: Build protobufs
run: USE_HTTPS=true ./proto-build.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
- name: Log in to ghcr.io
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set plugin deps and image suffix
id: plugin_deps
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
DEPS="${{ github.event.inputs.plugin_deps }}"
else
DEPS="nemocheck"
fi
echo "deps=$DEPS" >> $GITHUB_OUTPUT
# Normalize plugin deps for image suffix (replace commas with hyphens)
# Examples:
# "nemocheck" -> "nemocheck"
# "nemo,nemocheck" -> "nemo-nemocheck"
SUFFIX=$(echo "$DEPS" | tr ',' '-')
echo "suffix=$SUFFIX" >> $GITHUB_OUTPUT
# Example resulting image names:
# For tag v1.0.0 with PLUGIN_DEPS=nemocheck:
# ghcr.io/<repo>/plugins-adapter-nemocheck:v1.0.0
# ghcr.io/<repo>/plugins-adapter-nemocheck:latest
# For tag v1.0.0 with PLUGIN_DEPS=nemo,nemocheck:
# ghcr.io/<repo>/plugins-adapter-nemo-nemocheck:v1.0.0
# ghcr.io/<repo>/plugins-adapter-nemo-nemocheck:latest
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6
with:
images: ghcr.io/${{ github.repository }}/plugins-adapter
flavor: |
suffix=-${{ steps.plugin_deps.outputs.suffix }},onlatest=true
tags: |
type=ref,event=tag
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
- name: Build and push
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: PLUGIN_DEPS=${{ steps.plugin_deps.outputs.deps }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}