Skip to content

Commit

Permalink
refactor: remove addonfactory-get-splunk-package-version-action (#229)
Browse files Browse the repository at this point in the history
This PR decommissions use of
splunk/addonfactory-get-splunk-package-version-action, replacing it with
the direct code.
https://splunk.atlassian.net/browse/ADDON-68236
Tested here:
https://github.com/splunk/test-addonfactory-repo/actions/runs/7817333993/job/21325041323
  • Loading branch information
kdoroszko-splunk authored Feb 14, 2024
1 parent fb5244e commit 7c558f6
Showing 1 changed file with 55 additions and 8 deletions.
63 changes: 55 additions & 8 deletions .github/workflows/reusable-build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,33 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
- name: Determine the version to build
id: BuildVersion
uses: splunk/addonfactory-get-splunk-package-version-action@v1
with:
SemVer: ${{ steps.semantic.outputs.new_release_version }}
PrNumber: ${{ github.event.number }}
run: |
INPUT_SEMVER="${{ steps.semantic.outputs.new_release_version }}"
echo "Initial semver ${INPUT_SEMVER}"
INPUT_PRNUMBER="${{ github.event.number }}"
SEMVER_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+$'
BETA_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$'
echo working with version $INPUT_SEMVER
if [[ $INPUT_SEMVER =~ $SEMVER_REGEX ]];
then
echo using provided semver
VERSION=$INPUT_SEMVER
elif [[ $INPUT_SEMVER =~ $BETA_REGEX ]];
then
VERSION=$(echo $INPUT_SEMVER | awk '{gsub("-beta\.", "-B");print}')
else
if [[ $GITHUB_EVENT_NAME != 'pull_request' ]];
then
echo this is not a release build and NOT PR RUNID + run ID
VERSION=0.0.${GITHUB_RUN_ID}
else
echo this is not a release build and is a PR use run ID
VERSION=0.${INPUT_PRNUMBER}.${GITHUB_RUN_ID}
fi
fi
FINALVERSION="${VERSION//v}"
echo "Version to build is ${FINALVERSION}"
echo "VERSION=${FINALVERSION}" >> "$GITHUB_OUTPUT"
- name: Download THIRDPARTY
if: github.event_name != 'pull_request' && github.event_name != 'schedule'
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -721,10 +744,34 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
- id: BuildVersion
uses: splunk/addonfactory-get-splunk-package-version-action@v1
with:
SemVer: ${{ steps.semantic.outputs.new_release_version }}
PrNumber: ${{ github.event.number }}
run: |
INPUT_SEMVER="${{ steps.semantic.outputs.new_release_version }}"
echo "Initial semver ${INPUT_SEMVER}"
INPUT_PRNUMBER="${{ github.event.number }}"
SEMVER_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+$'
BETA_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$'
echo working with version $INPUT_SEMVER
if [[ $INPUT_SEMVER =~ $SEMVER_REGEX ]];
then
echo using provided semver
VERSION=$INPUT_SEMVER
elif [[ $INPUT_SEMVER =~ $BETA_REGEX ]];
then
VERSION=$(echo $INPUT_SEMVER | awk '{gsub("-beta\.", "-B");print}')
else
if [[ $GITHUB_EVENT_NAME != 'pull_request' ]];
then
echo this is not a release build and NOT PR RUNID + run ID
VERSION=0.0.${GITHUB_RUN_ID}
else
echo this is not a release build and is a PR use run ID
VERSION=0.${INPUT_PRNUMBER}.${GITHUB_RUN_ID}
fi
fi
FINALVERSION="${VERSION//v}"
echo "Version to build is $FINALVERSION"
echo "VERSION=$FINALVERSION" >> "$GITHUB_OUTPUT"
- id: uccgen
uses: splunk/addonfactory-ucc-generator-action@v2
with:
Expand Down

0 comments on commit 7c558f6

Please sign in to comment.