Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/deploy-artifacts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ structure_build_artifacts() {
echo "current files: $(ls -la build-artifacts)" >&2
mkdir -p structured_build_artifacts/deb
mkdir -p structured_build_artifacts/rpm
mkdir -p structured_build_artifacts/jar
mkdir -p structured_build_artifacts/generic
while IFS= read -r -d '' deb; do
if [[ ! -f "$deb" ]]; then
Expand All @@ -145,6 +146,16 @@ structure_build_artifacts() {
done < <(find build-artifacts -name "*.rpm" -print0)
echo "current files: $(ls -la build-artifacts)" >&2

while IFS= read -r -d '' jar; do
if [[ ! -f "$jar" ]]; then
continue
fi

echo "Processing JAR: $jar" >&2
process_rpm "$jar" "./structured_build_artifacts/jar"
done < <(find build-artifacts -name "*.jar" -print0)
echo "current files: $(ls -la build-artifacts)" >&2

while IFS= read -r -d '' generic; do
if [[ ! -f "$generic" ]]; then
echo "Skipping non-file: $generic" >&2
Expand Down Expand Up @@ -232,6 +243,42 @@ upload_rpm_packages() {
done < <(find . -name "*.rpm" -print0)
}

upload_jar_packages() {
if [[ "$DRY_RUN" == "true" ]]; then
echo "Would upload JAR packages to JFrog..." >&2
else
echo "Uploading JAR packages to JFrog..." >&2
fi
while IFS= read -r -d '' jar; do
if [[ ! -f "$jar" ]]; then
continue
fi

# Get metadata using the shared function
read -r -a metadata < <(get_jar_metadata "$jar")
pkgname="${metadata[0]}"
version="${metadata[1]}"

echo " Package: $pkgname, Version: $version" >&2

# Upload the RPM
run jf rt upload "$jar" "$PROJECT-maven-dev-local" --flat=false \
--build-name="$BUILD_NAME" \
--build-number="$ARTIFACT_BUILD_NUMBER" \
--project="$PROJECT" \
--target-props "version=$VERSION"

# Upload signature and checksums if they exist
if [[ -f "$jar.asc" ]]; then
echo " Uploading signature: $jar.asc" >&2
run jf rt upload "$jar.asc" "$PROJECT-maven-dev-local" --flat=false \
--build-name="$BUILD_NAME" \
--build-number="$ARTIFACT_BUILD_NUMBER" \
--project="$PROJECT"
fi
done < <(find . -name "*.jar" -print0)
}

upload_generic_files() {
if [[ "$DRY_RUN" == "true" ]]; then
echo "Would upload generic files..." >&2
Expand Down Expand Up @@ -351,6 +398,9 @@ main() {
cd deb
upload_deb_packages
cd ..
cd jar
upload_jar_packages
cd ..
cd generic
upload_generic_files
cd ..
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/deploy-artifacts/package_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
exit 1
}

# Function to extract JAR metadata
get_jar_metadata() {
local jar="$1"
local filename="${jar##*/}" # Get just the filename without path
local pkgname version

pkgname=$(echo "$filename" | sed 's/-[0-9.]*\.jar$//')

Check notice on line 19 in .github/workflows/deploy-artifacts/package_utils.sh

View workflow job for this annotation

GitHub Actions / Trunk Check

shellcheck(SC2001)

[new] See if you can use ${variable//search/replace} instead.
version=$(echo "$filename" | sed 's/.*-//' | sed 's/\.jar$//')

# Return package name and version
echo "$pkgname $version"
}

# Function to extract RPM metadata and distribution
# Unlike for debs this requires parsing the name (because the distro name is not standard)
get_rpm_metadata() {
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/reusable_execute-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,28 @@ on:
type: string
default: .

# Java/Maven setup
setup-java:
description: Whether to set up Java environment
required: false
type: boolean
default: false
java-version:
description: Java version to set up (e.g., "17", "21")
required: false
type: string
default: "21"
java-distribution:
description: Java distribution (temurin, zulu, adopt, corretto, etc.)
required: false
type: string
default: temurin
java-cache:
description: Package manager to cache (maven, gradle, sbt).
required: false
type: string
default: maven

outputs:
gh-artifact-name:
description: The name of the uploaded artifacts on github
Expand Down Expand Up @@ -146,6 +168,14 @@ jobs:
submodules: recursive
fetch-depth: 1

- name: Set up Java
if: inputs.setup-java
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
cache: ${{ inputs.java-cache }}

- name: Set up JFrog CLI
uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1
env:
Expand Down
Loading