Skip to content

Merge pull request #1436 from DependencyTrack/dependabot/github_actio… #907

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

Merge pull request #1436 from DependencyTrack/dependabot/github_actio… #907

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@6a0805fcefea3d4657a47ac4c165951e33482018 # tag=v4.2.2
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@988b5a0280414f521da01fcc63a27aeeb4b104db # tag=v3.6.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' }}