Skip to content

Build and Release the Serverless Compat Java Agent #8

Build and Release the Serverless Compat Java Agent

Build and Release the Serverless Compat Java Agent #8

Workflow file for this run

name: Build and Release the Serverless Compat Java Agent
on: workflow_dispatch
permissions: {}
jobs:
build:
name: Build Serverless Compat Java Agent
runs-on: ubuntu-latest
outputs:
package-version: ${{ steps.package.outputs.package-version }}
serverless-compat-version: ${{ steps.serverless-compat-binary.outputs.serverless-compat-version }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: package
run: |
PACKAGE_VERSION=$(awk -F '[<>]' '/<version>/{print $3; exit}' pom.xml)
echo "package-version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
- id: serverless-compat-binary
run: |
LIBDATADOG_RESPONSE=$(curl -s "https://api.github.com/repos/datadog/libdatadog/releases")
SERVERLESS_COMPAT_VERSION=$(echo "$LIBDATADOG_RESPONSE" | jq -r --arg pattern "sls-v[0-9]*\.[0-9]*\.[0-9]*" '.[] | select(.tag_name | test($pattern)) | .tag_name' | sort -V | tail -n 1)
echo "Using version ${SERVERLESS_COMPAT_VERSION} of Serverless Compatibility Layer binary"
echo "serverless-compat-version=$(echo "$SERVERLESS_COMPAT_VERSION" | jq -rR 'ltrimstr("sls-")')" >> "$GITHUB_OUTPUT"
curl --output-dir ./temp/ --create-dirs -O -s -L "https://github.com/DataDog/libdatadog/releases/download/${SERVERLESS_COMPAT_VERSION}/datadog-serverless-agent.zip"
unzip ./temp/datadog-serverless-agent.zip -d ./temp/datadog-serverless-agent
mkdir -p bin/linux-amd64 bin/windows-amd64
cp ./temp/datadog-serverless-agent/datadog-serverless-agent-linux-amd64/datadog-serverless-trace-mini-agent bin/linux-amd64/datadog-serverless-compat
cp ./temp/datadog-serverless-agent/datadog-serverless-agent-windows-amd64/datadog-serverless-trace-mini-agent.exe bin/windows-amd64/datadog-serverless-compat.exe
- uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- run: ./build.sh
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: target
path: target/*
release:
name: Release
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
env:
PACKAGE_VERSION: ${{ needs.build.outputs.package-version }}
SERVERLESS_COMPAT_VERSION: ${{ needs.build.outputs.serverless-compat-version }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- run: |
cp target/dd-serverless-compat-java-agent-${{ env.PACKAGE_VERSION }}.jar target/dd-serverless-compat-java-agent.jar
cp target/dd-serverless-compat-java-agent-${{ env.PACKAGE_VERSION }}.jar target/dd-serverless-azure-java-agent-${{ env.PACKAGE_VERSION }}.jar
cp target/dd-serverless-compat-java-agent-${{ env.PACKAGE_VERSION }}.jar target/dd-serverless-azure-java-agent.jar
- uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
with:
body: "Uses [${{ env.SERVERLESS_COMPAT_VERSION }}](https://github.com/DataDog/libdatadog/releases/tag/sls-${{ env.SERVERLESS_COMPAT_VERSION }}) of the Serverless Compatibility Layer binary."
draft: true
tag_name: "v${{ env.PACKAGE_VERSION }}"
generate_release_notes: true
make_latest: true
files: |
target/dd-serverless-compat-java-agent-${{ env.PACKAGE_VERSION }}.jar
target/dd-serverless-compat-java-agent.jar
target/dd-serverless-azure-java-agent-${{ env.PACKAGE_VERSION }}.jar
target/dd-serverless-azure-java-agent.jar
- uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
with:
name: Latest
tag_name: download-latest
body: "This release tracks the latest version available, currently **${{ env.PACKAGE_VERSION }}**."
files: |
target/dd-serverless-compat-java-agent.jar
target/dd-serverless-azure-java-agent.jar