-
Notifications
You must be signed in to change notification settings - Fork 270
177 lines (152 loc) · 7.05 KB
/
release-images.yaml
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
name: Release Images
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag name'
required: true
release:
types: [released, prereleased]
env:
# The values are extracted from the github.event context,
# which is only available when the workflow gets triggered by a release event.
RELEASE_VERSION: ${{ github.event.release.name }}
BRANCH: ${{ github.event.release.target_commitish }}
jobs:
release-images:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
RELEASE_TYPE: release
steps:
- name: View Disk Usage
run: df -h
# https://github.com/marketplace/actions/free-disk-space-ubuntu
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@76866dbe54312617f00798d1762df7f43def6e5c
with:
android: true
dotnet: true
haskell: true
swap-storage: true
large-packages: false
# this might remove tools that are actually needed, but frees about 6 GB
tool-cache: false
- name: View Disk Usage
run: df -h
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# Docker CLI plugin for extended build capabilities with BuildKit
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Fetch Release Details
if: github.event_name == 'workflow_dispatch'
run: |
touch release.json && curl https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.event.inputs.tag }} > release.json
echo "RELEASE_VERSION=$(cat release.json | jq -r '.name')" >> $GITHUB_ENV
echo "BRANCH=$(cat release.json | jq -r '.target_commitish')" >> $GITHUB_ENV
- name: Determine Release Type
if: "contains(env.RELEASE_VERSION, 'RC')"
run: |
echo "This is a pre-release. Setting 'RELEASE_TYPE' to 'pre-release'"
echo "RELEASE_TYPE=pre-release" >> $GITHUB_ENV
- name: Download Source Code
run: git clone --branch $RELEASE_VERSION --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git registry
# We have faced issues in the past where a github release was created from a wrong commit
# This step will ensure that the release was created from the right commit
- name: Verify Project Version
run: |
cd registry
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ $PROJECT_VERSION != $RELEASE_VERSION ]]
then
echo "ERROR: Project Version '${PROJECT_VERSION}' does not match with Released Version '${RELEASE_VERSION}'"
exit 1
fi
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18
- name: Build Registry
run: |
cd registry
./mvnw clean package -am --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5 -Dspotless.check.skip=true
- name: Build Registry UI
working-directory: registry/ui
run: |
npm install
npm run lint
npm run build
npm run package
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Login to Quay.io Registry
run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
# Do this first in case something goes wrong.
# TODO: Push to DockerHub
- name: Build and Push Operator Image
working-directory: registry/operator
run: |
make config-show
make ADDITIONAL_IMAGE_TAG=latest image-build image-push
- name: Build and Push Multi-arch Application Images
run: |
cd registry
docker buildx build --push -f ./distro/docker/target/docker/Dockerfile.jvm \
-t docker.io/apicurio/apicurio-registry:latest \
-t docker.io/apicurio/apicurio-registry:latest-release \
-t docker.io/apicurio/apicurio-registry:$RELEASE_VERSION \
-t quay.io/apicurio/apicurio-registry:latest \
-t quay.io/apicurio/apicurio-registry:latest-release \
-t quay.io/apicurio/apicurio-registry:$RELEASE_VERSION \
--platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le ./distro/docker/target/docker
- name: Build and Push Multi-arch UI Images
run: |
cd registry/ui
docker buildx build --push -f ./Dockerfile \
-t docker.io/apicurio/apicurio-registry-ui:latest \
-t docker.io/apicurio/apicurio-registry-ui:latest-release \
-t docker.io/apicurio/apicurio-registry-ui:$RELEASE_VERSION \
-t quay.io/apicurio/apicurio-registry-ui:latest \
-t quay.io/apicurio/apicurio-registry-ui:latest-release \
-t quay.io/apicurio/apicurio-registry-ui:$RELEASE_VERSION \
--platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le .
- name: Build Native executables
env:
SKIP_TESTS: "true"
run: |
cd registry
./mvnw package --no-transfer-progress -Pnative -Dquarkus.native.container-build=true -Pprod -DskipTests=true
- name: Build and Push Native image for testing
run: |
cd registry
docker build --push -f ./distro/docker/target/docker/Dockerfile.native \
-t docker.io/apicurio/apicurio-registry-native:latest \
-t docker.io/apicurio/apicurio-registry-native:latest-release \
-t docker.io/apicurio/apicurio-registry-native:$RELEASE_VERSION \
-t quay.io/apicurio/apicurio-registry-native:latest \
-t quay.io/apicurio/apicurio-registry-native:latest-release \
-t quay.io/apicurio/apicurio-registry-native:$RELEASE_VERSION \
app/
- name: Google Chat Notification
if: ${{ failure() }}
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}