chore(deps): bump actions/upload-artifact from 4.3.1 to 4.5.0 #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# | |
# Copyright (c) 2023,2024 T-Systems International GmbH | |
# Copyright (c) 2023 SAP SE | |
# Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | |
# | |
# See the NOTICE file(s) distributed with this work for additional | |
# information regarding copyright ownership. | |
# | |
# This program and the accompanying materials are made available under the | |
# terms of the Apache License, Version 2.0 which is available at | |
# https://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 | |
# | |
name: "Build" | |
on: | |
# Runs automatically on main and release branches | |
push: | |
branches: | |
- main | |
- 'release/*' | |
# Can be scheduled on all branches and version tags | |
tags: | |
- 'v*.*.*' | |
- 'v*.*.*-*' | |
# Runs automatically on all code-related PRs to main and release branches | |
pull_request: | |
branches: | |
- main | |
- 'release/*' | |
paths-ignore: | |
- 'charts/**' | |
- 'docs/**' | |
- '**/*.md' | |
# Manual workflow trigger | |
workflow_dispatch: | |
inputs: | |
deploy_maven: | |
description: 'whether maven packages should be deployed (default: false)' | |
default: 'false' | |
required: false | |
type: string | |
deploy_docker: | |
description: 'whether docker images should be deployed (default: true)' | |
default: 'true' | |
required: false | |
type: string | |
# If build is triggered several times, e.g., through subsequent pushes | |
# into the same PR, cancel the previous runs, see below | |
concurrency: | |
# cancel only running jobs on pull requests | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
# Actual build/deploy logic | |
jobs: | |
# Build maven and docker stuff | |
build: | |
name: Build/Deploy Maven & Docker Artifacts | |
runs-on: ubuntu-latest | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
steps: | |
# Determine the right target docker repo | |
- name: Check github repository and set docker repo | |
id: set-docker-repo | |
run: | | |
echo "REGISTRY=docker.io" >> $GITHUB_OUTPUT; | |
echo "REPO=tractusx" >> $GITHUB_OUTPUT; | |
if [ "${{ github.repository }}" != "eclipse-tractusx/knowledge-agents-aas-bridge" ]; | |
then | |
echo "REGISTRY=ghcr.io" >> $GITHUB_OUTPUT | |
echo "REPO=ghcr.io/${{ github.repository }}" >> $GITHUB_OUTPUT | |
fi | |
exit 0 | |
# Get the Code | |
- name: Checkout repository | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
submodules: recursive | |
# Set-Up | |
- name: Setup JDK 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
# Needed to create multi-platform image | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 #(v3.7.1) | |
# Enable deployment access (on demand or main branch and version tags only) | |
- name: Login to GitHub Container Registry | |
if: ${{ ( github.event.inputs.deploy_docker == 'true' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ steps.set-docker-repo.outputs.REGISTRY }} | |
# Use existing DockerHub credentials present as secrets | |
username: ${{ secrets.DOCKER_HUB_USER || github.actor }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN || secrets.GITHUB_TOKEN }} | |
# Run Maven Deploy (on demand or if either running on main or a version tag) | |
- name: Deploy Java via Maven | |
if: ${{ ( github.event.inputs.deploy_maven == 'true' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} | |
run: | | |
./mvnw -s settings.xml deploy -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Run Maven Install (otherwise) | |
- name: Build Java via Maven | |
if: ${{ ( github.event.inputs.deploy_maven != 'true' && github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v') ) }} | |
run: | | |
./mvnw -s settings.xml install | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Create SemVer or ref tags dependent of trigger event | |
- name: Docker Meta AAS Bridge | |
id: meta-aas | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | |
with: | |
images: | | |
${{ steps.set-docker-repo.outputs.REPO }}/aas-bridge | |
# Automatically prepare image tags; See action docs for more examples. | |
# semver patter will generate tags like these for example :1 :1.2 :1.2.3 | |
tags: | | |
type=sha,event=branch | |
type=sha,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=raw,value=1.14.24-SNAPSHOT,enable=${{ github.event.inputs.deploy_docker == 'true' || github.ref == format('refs/heads/{0}', 'main') }} | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
# build in any case, but push only main and version tag settings | |
- name: AAS Bridge Container Build and Push | |
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0 | |
with: | |
context: sparql-aas/. | |
file: sparql-aas/src/main/docker/Dockerfile | |
# Needed to create multi-platform image | |
platforms: linux/amd64, linux/arm64 | |
# Build image for verification purposes on every trigger event. Only push if event is not a PR | |
push: ${{ ( github.event.inputs.deploy_docker == 'true' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }} | |
tags: ${{ steps.meta-aas.outputs.tags }} | |
labels: ${{ steps.meta-aas.outputs.labels }} | |
# Important step to push image description to DockerHub - since this is version independent, we always take it from main | |
- name: Update Docker Hub description for AAS Bridge | |
if: ${{ steps.set-docker-repo.outputs.REPO == 'docker.io' && github.ref == 'refs/heads/main' }} | |
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 | |
with: | |
readme-filepath: sparql-aas/README.md | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
repository: ${{ steps.set-docker-repo.outputs.REPO }}/aas-bridge | |