Skip to content

Merge pull request #1355 from DependencyTrack/dependabot/github_actio… #844

Merge pull request #1355 from DependencyTrack/dependabot/github_actio…

Merge pull request #1355 from DependencyTrack/dependabot/github_actio… #844

Workflow file for this run

# 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@692973e3d937129bcbf40652eb9f2f61becf3332 # tag=v4.1.7
- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v4.2.1
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # tag=v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # tag=v3.3.0
with:
install: true
- name: Docker login
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # tag=v3.2.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' }}