-
Notifications
You must be signed in to change notification settings - Fork 6
114 lines (102 loc) · 3.92 KB
/
build.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
name: Docker Build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
env:
IMAGE_REGISTRY_NAMESPACE: alfresco
IMAGE_REPOSITORY: alfresco-activemq
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
docker:
name: activemq ${{ matrix.activemq_base_version }}
strategy:
matrix:
base_image:
- flavor: rockylinux
major: 8
java_major:
- 17
jdist:
- jre
activemq_base_version:
- 5.16
- 5.17
- 5.18
env:
# Which activemq_base_version of the matrix should produce `latest` tag
ACTIVEMQ_LATEST_VERSION: 5.18
runs-on: ubuntu-latest
needs: pre-commit
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- id: vars
name: Compute vars
env:
ACTIVEMQ_BASE_VERSION: ${{ matrix.activemq_base_version }}
run: |
ACTIVEMQ_VERSION=$(jq -r .activemq_version versions/activemq-${ACTIVEMQ_BASE_VERSION}.json)
echo "activemq_version=$ACTIVEMQ_VERSION" >> $GITHUB_OUTPUT
echo "image_created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
QUAY_IMAGE_NAME="quay.io/${IMAGE_REGISTRY_NAMESPACE}/${IMAGE_REPOSITORY}"
DOCKERHUB_IMAGE_NAME="${IMAGE_REGISTRY_NAMESPACE}/${IMAGE_REPOSITORY}"
TAG_COMMON_METADATA="${{ matrix.jdist }}${{ matrix.java_major }}-${{ matrix.base_image.flavor }}${{ matrix.base_image.major }}"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "labels=quay.expires-after=1d" >> $GITHUB_OUTPUT
IMAGE_TAG_PR="${ACTIVEMQ_VERSION}-${TAG_COMMON_METADATA}-pr-${{ github.event.pull_request.number}}"
echo "tags=${QUAY_IMAGE_NAME}:${IMAGE_TAG_PR}" >> $GITHUB_OUTPUT
else
IMAGE_TAG_SEMVER="${ACTIVEMQ_VERSION}-${TAG_COMMON_METADATA}"
IMAGE_TAG_MINOR="${ACTIVEMQ_BASE_VERSION}-${TAG_COMMON_METADATA}"
echo "tags<<EOF" >> $GITHUB_OUTPUT
echo "${QUAY_IMAGE_NAME}:${IMAGE_TAG_SEMVER}" >> $GITHUB_OUTPUT
echo "${QUAY_IMAGE_NAME}:${IMAGE_TAG_MINOR}" >> $GITHUB_OUTPUT
echo "${DOCKERHUB_IMAGE_NAME}:${IMAGE_TAG_SEMVER}" >> $GITHUB_OUTPUT
echo "${DOCKERHUB_IMAGE_NAME}:${IMAGE_TAG_MINOR}" >> $GITHUB_OUTPUT
if [ "${ACTIVEMQ_BASE_VERSION}" == "$ACTIVEMQ_LATEST_VERSION" ]; then
echo "${QUAY_IMAGE_NAME}:latest" >> $GITHUB_OUTPUT
echo "${DOCKERHUB_IMAGE_NAME}:latest" >> $GITHUB_OUTPUT
fi
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Login to docker.io
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
build-args: |
ACTIVEMQ_VERSION=${{ steps.vars.outputs.activemq_version }}
JDIST=${{ matrix.jdist }}
DISTRIB_NAME=${{ matrix.base_image.flavor }}
DISTRIB_MAJOR=${{ matrix.base_image.major }}
JAVA_MAJOR=${{ matrix.java_major }}
REVISION=${{ github.run_number }}
CREATED=${{ steps.vars.outputs.image_created }}
tags: |
${{ steps.vars.outputs.tags }}
labels: |
${{ steps.vars.outputs.labels }}
provenance: false
target: ACTIVEMQ_IMAGE
platforms: linux/amd64,linux/arm64/v8