-
-
Notifications
You must be signed in to change notification settings - Fork 18
84 lines (80 loc) · 3.25 KB
/
publishJar.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
# This file is part of Dependency-Track.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.
name: Publish Jar
on:
push:
branches:
- main
- "feature-**"
permissions: { }
jobs:
publish-container-image:
name: Publish Jar based Container Images
runs-on: ubuntu-latest
permissions:
actions: write # Required to trigger e2e workflow
packages: write # Required to push images to ghcr.io
timeout-minutes: 15
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # tag=v4.5.0
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # tag=v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # tag=v3.7.1
with:
install: true
- name: Docker login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # tag=v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine Container Tags
id: determine-container-tags
run: |-
TAG=""
ADDITIONAL_TAGS=""
if [[ $GITHUB_REF_NAME == feature-* ]]; then
TAG="${GITHUB_REF_NAME,,}"
else
TAG="$(yq -p=xml '.project.version' pom.xml)"
ADDITIONAL_TAGS="snapshot"
fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "additional-tags=${ADDITIONAL_TAGS}" >> $GITHUB_OUTPUT
- name: Build and push container images
run: |-
mvn -B --no-transfer-progress clean install -DskipTests \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.group=${GITHUB_REPOSITORY_OWNER,,} \
-Dquarkus.container-image.tag=${{ steps.determine-container-tags.outputs.tag }} \
-Dquarkus.container-image.additional-tags=${{ steps.determine-container-tags.outputs.additional-tags }} \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.push=true \
-Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64
- name: Run end-to-end tests
env:
GH_TOKEN: ${{ github.token }}
run: |-
gh workflow run e2e-test.yml \
-f hyades-version=${{ startsWith(steps.determine-container-tags.outputs.tag, 'feature-') && steps.determine-container-tags.outputs.tag || 'snapshot' }}