-
Notifications
You must be signed in to change notification settings - Fork 4
164 lines (147 loc) · 4.91 KB
/
Copy pathclient-components.yaml
File metadata and controls
164 lines (147 loc) · 4.91 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: client-components
permissions:
contents: read
packages: write
on:
push:
tags:
- "v*.*.*"
branches:
- b-*
- main
- dev
jobs:
build:
name: build-${{ matrix.component }}-${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
component: [cordium]
arch:
- amd64
- arm64
include:
- arch: amd64
platform: linux/amd64
runner: ubuntu-24.04
- arch: arm64
platform: linux/arm64
runner: ubuntu-24.04-arm
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set ENV variables
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: for v in `cat .github/workflows/env` ; do echo "::set-env name=${v%%=*}::${v##*=}" ; done
- name: Set is latest
run: |
IS_LATEST=$(git tag | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -r --version-sort | head -n1)
echo $IS_LATEST
if [ "$IS_LATEST" = ${{ env.GITHUB_REF_SLUG }} ]; then
echo "V_IS_LATEST=true" >> $GITHUB_ENV
else
echo "V_IS_LATEST=false" >> $GITHUB_ENV
fi
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{env.V_CONTAINER_REGISTRY}}/${{env.V_ORG}}/${{matrix.component}}
flavor: |
latest=false
prefix=
suffix=-${{ matrix.arch }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Registry
uses: docker/login-action@v3
with:
registry: ${{env.V_CONTAINER_REGISTRY}}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: client/${{matrix.component}}/Dockerfile
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
create-manifest:
name: Create manifest for ${{ matrix.component }}
needs: build
runs-on: ubuntu-24.04
strategy:
matrix:
component: [cordium]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set ENV variables
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: for v in `cat .github/workflows/env` ; do echo "::set-env name=${v%%=*}::${v##*=}" ; done
- name: Set is latest
run: |
IS_LATEST=$(git tag | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -r --version-sort | head -n1)
echo $IS_LATEST
if [ "$IS_LATEST" = ${{ env.GITHUB_REF_SLUG }} ]; then
echo "V_IS_LATEST=true" >> $GITHUB_ENV
else
echo "V_IS_LATEST=false" >> $GITHUB_ENV
fi
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{env.V_CONTAINER_REGISTRY}}/${{env.V_ORG}}/${{matrix.component}}
flavor: |
latest=${{env.V_IS_LATEST}}
prefix=
suffix=
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{env.V_CONTAINER_REGISTRY}}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest with annotations
env:
LABELS: ${{ steps.meta.outputs.labels }}
BASE_IMAGE: ${{env.V_CONTAINER_REGISTRY}}/${{env.V_ORG}}/${{matrix.component}}
VERSION: ${{ steps.meta.outputs.version }}
run: |
TAGS="${{ steps.meta.outputs.tags }}"
ANNOTATIONS=()
while IFS='=' read -r key value; do
if [ -n "$key" ] && [ -n "$value" ]; then
ANNOTATIONS+=("--annotation" "index:${key}=${value}")
fi
done <<< "$LABELS"
for TAG in $TAGS; do
echo "Creating manifest for $TAG"
docker buildx imagetools create \
"${ANNOTATIONS[@]}" \
-t "$TAG" \
"${BASE_IMAGE}:${VERSION}-amd64" \
"${BASE_IMAGE}:${VERSION}-arm64"
done