-
Notifications
You must be signed in to change notification settings - Fork 21
178 lines (157 loc) · 5.37 KB
/
release.yml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release Images
on:
workflow_call:
inputs:
branch:
description: "The infinispan-images branch to checkout when cutting the release."
required: true
default: "main"
type: string
repository:
description: "The repository to checkout when cutting the release."
required: true
default: "infinispan/infinispan-images"
type: string
ispnVersion:
description: 'Version of Infinispan artifacts to be used'
required: true
type: string
images:
description: 'A comma-separated list of images to be released'
default: 'server, server-native, cli'
type: string
latest:
description: 'If true, updates the :latest tag to equal this release for each selected image'
default: true
type: boolean
push:
description: 'If false, we skip pushing the image to remote repositories'
default: true
type: boolean
workflow_dispatch:
inputs:
branch:
description: "The infinispan-images branch to checkout when cutting the release."
required: true
default: "main"
type: string
ispnVersion:
description: 'Version of Infinispan artifacts to be used'
required: true
type: string
images:
description: 'A comma-separated list of images to be released'
default: 'server, server-native, cli'
type: string
latest:
description: 'If true, updates the :latest tag to equal this release for each selected image'
default: true
type: boolean
push:
description: 'If false, we skip pushing the image to remote repositories'
default: true
type: boolean
jobs:
meta:
runs-on: ubuntu-latest
outputs:
image-matrix: ${{ steps.images.outputs.matrix }}
steps:
- id: images
run: |
IMAGES=$(echo ${{ inputs.images }} | sed -n 's/server/server-openjdk/p')
echo "matrix=$(echo ${IMAGES} | jq -Rc 'split(", ")')" >> $GITHUB_OUTPUT
release:
needs: [meta]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
descriptor: ${{ fromJson(needs.meta.outputs.image-matrix) }}
env:
IMAGE: ${{ matrix.descriptor == 'server-openjdk' && 'server' || matrix.descriptor }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- name: Install CEKit
uses: cekit/actions-setup-cekit@v1.1.5
- name: Install yq
run: sudo snap install yq
- name: Update Descriptor Versions
run: echo "IMAGE_VERSION=$(./.github/scripts/update_image_descriptors.sh)" >> $GITHUB_ENV
env:
ISPN_VERSION: ${{ inputs.ispnVersion }}
DESCRIPTOR: ${{ matrix.descriptor }}
- name: Generate Image Tags
run: echo "IMAGE_TAGS=$(./.github/scripts/image_tags.sh)" >> $GITHUB_ENV
env:
IMAGE_VERSION: ${{ env.IMAGE_VERSION }}
DESCRIPTOR: ${{ matrix.descriptor }}
LATEST: ${{ inputs.latest }}
- name: Create Dockerfile
run: cekit -v --descriptor ${{ matrix.descriptor }}.yaml build --dry-run docker --pull
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Quay
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build
uses: docker/build-push-action@v3
with:
context: ./target/image
platforms: linux/amd64,linux/arm64
pull: true
push: ${{ inputs.push }}
file: target/image/Dockerfile
tags: ${{ env.IMAGE_TAGS }}
- name: Commit changes and create patch
run: |
git config user.email "infinispan@infinispan.org"
git config user.name "Infinispan"
git add ${{ matrix.descriptor }}.yaml
git commit -m "Releasing Version ${IMAGE_VERSION} of ${IMAGE} image"
git format-patch -1 --stdout > patch
- name: Upload Patch
uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE }}-${{ env.IMAGE_VERSION }}
path: patch
tag:
needs: [release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- name: Download Patches
uses: actions/download-artifact@v4
with:
path: patches
- name: Commit changes and create tag
run: |
ls -R patches
git config user.email "infinispan@infinispan.org"
git config user.name "Infinispan"
for PATCH in $(find patches -maxdepth 1 -mindepth 1 -type d -printf '%f\n'); do
git am < patches/${PATCH}/patch
git tag ${PATCH}
done
git log -4
- name: Push Git changes
uses: ad-m/github-push-action@master
if: inputs.push
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ inputs.branch }}
tags: true