-
Notifications
You must be signed in to change notification settings - Fork 14
80 lines (70 loc) · 2.87 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
name: Release
env:
IMAGE_NAME: activemq-artemis-broker
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
trigger_children:
description: 'Trigger children'
required: false
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install prerequisites
run: >
sudo apt-get install gcc libkrb5-dev pass &&
sudo pip install docker==5.0.3 docker-squash cekit odcs[client] packaging==21.3
- name: Checkout the repo
uses: actions/checkout@v3
- name: Create release tag
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
git fetch --tags
HEAD_COMMIT="$(git rev-parse HEAD)"
RELEASE_TAG="v$(grep -Po -m 1 '(?<=^version: ")[^"]+' image.yaml)"
RELEASE_TAG_COMMIT="$(git rev-list -n 1 ${RELEASE_TAG} || true)"
if [ "$RELEASE_TAG_COMMIT" != "$HEAD_COMMIT" ]; then
git config user.name 'artemiscloud-bot'
git config user.email '[email protected]'
git tag -a ${RELEASE_TAG} -m ${RELEASE_TAG} --force
git push origin $RELEASE_TAG --force
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Build the image
run: |
cekit --verbose build --dry-run podman
podman build --platform linux/amd64 --platform linux/arm64 --manifest $IMAGE_NAME:latest ./target/image
- name: Push the image
run: |
IMAGE_TAG="$(git describe --exact-match --tags | sed 's/v//')"
ARTEMIS_TAG="artemis.$(podman image inspect $IMAGE_NAME:latest | grep -Po -m 1 '(?<=APACHE_ARTEMIS_VERSION=)[^"]*')"
podman login --username=${{ secrets.QUAY_USERNAME }} --password=${{ secrets.QUAY_PASSWORD }} quay.io
podman manifest push $IMAGE_NAME:latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:latest
podman manifest push $IMAGE_NAME:latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:$IMAGE_TAG
podman manifest push $IMAGE_NAME:latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:$ARTEMIS_TAG
- name: Trigger children
if: ${{ inputs.trigger_children }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: 'activemq-artemis-broker-kubernetes-image',
workflow_id: 'update.yml',
ref: 'main',
inputs: {
version: '*.*.+',
update_version: 'true',
base_image: 'latest',
update_base_image: 'true',
trigger_release: 'all'
}
});