From a414529e6ca04f4b01c20dc0a2911b9817442c1b Mon Sep 17 00:00:00 2001 From: cleverchuk Date: Tue, 2 Jul 2024 10:12:51 -0400 Subject: [PATCH] NH-37575: download agent from GitHub --- .github/workflows/push.yml | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8394a97c..d40e7465 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -42,7 +42,7 @@ jobs: run: | VERSION=$(unzip -p agent/build/libs/solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }') VERSION=$(echo $VERSION | sed 's/[^a-z0-9.-]//g') # remove illegal characters - VERSION="$VERSION-alpha" + VERSION="$VERSION.alpha" echo "Current version is $VERSION" response=$(curl -fs -L \ @@ -77,6 +77,46 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_release_clean: + runs-on: ubuntu-latest + needs: + - benchmark + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Build agent + run: ./gradlew clean build -x test + + - name: Clean up Pre-release + run: | + VERSION=$(unzip -p agent/build/libs/solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }') + VERSION=$(echo $VERSION | sed 's/[^a-z0-9.-]//g') # remove illegal characters + VERSION="$VERSION.alpha" + echo "Current version is $VERSION" + + response=$(curl -fs -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/v$VERSION + + release_id=$(echo "$response" | jq -r '.id') + curl -fsL \ + -X DELETE \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$release_id + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + s3-stage-upload: # this job uploads the jar to stage s3 runs-on: ubuntu-latest steps: @@ -139,6 +179,7 @@ jobs: --acl public-read + build-test-images: runs-on: ubuntu-latest needs: