Skip to content
Draft
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
32 changes: 32 additions & 0 deletions .github/workflows/prerelease_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,41 @@ on:
default: true
required: false

# Added 'contents: read' to allow fetching release information
permissions:
id-token: write
contents: read

jobs:
validate-tag:
name: Validate Input Tag
runs-on: ubuntu-latest
steps:
- name: Validate that tag is the latest pre-release
env:
GH_TOKEN: ${{ github.token }}
INPUT_TAG: ${{ github.event.inputs.tag }}
run: |
echo "Fetching latest pre-release tag from newrelic/infrastructure-agent..."

# Use the GitHub CLI to call the API, find all pre-releases, and get the tag_name of the very first one (the latest)
LATEST_PRERELEASE_TAG=$(gh api /repos/newrelic/infrastructure-agent/releases --jq 'map(select(.prerelease == true)) | .[0].tag_name')

if [ -z "$LATEST_PRERELEASE_TAG" ]; then
echo "Could not determine the latest pre-release tag. Please check the repository."
exit 1
fi

echo "Input tag: $INPUT_TAG"
echo "Latest pre-release tag: $LATEST_PRERELEASE_TAG"

if [ "$INPUT_TAG" == "$LATEST_PRERELEASE_TAG" ]; then
echo "Validation successful. Input tag matches the latest pre-release."
else
echo "Validation Failed: The provided tag is not the latest pre-release."
exit 1
fi

test-prerelease-windows:
if: ${{ github.event.inputs.windows == 'true' }}
uses: ./.github/workflows/component_prerelease_testing.yml
Expand All @@ -35,6 +66,7 @@ jobs:
CROWDSTRIKE_CUSTOMER_ID: ${{secrets.CROWDSTRIKE_CUSTOMER_ID}}

test-prerelease-linux:
needs: validate-tag
if: ${{ github.event.inputs.linux == 'true' }}
uses: ./.github/workflows/component_prerelease_testing.yml
with:
Expand Down
Loading