Skip to content

Commit 7c558f6

Browse files
refactor: remove addonfactory-get-splunk-package-version-action (#229)
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
1 parent fb5244e commit 7c558f6

File tree

1 file changed

+55
-8
lines changed

1 file changed

+55
-8
lines changed

.github/workflows/reusable-build-test-release.yml

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,33 @@ jobs:
590590
GITHUB_TOKEN: ${{ github.token }}
591591
- name: Determine the version to build
592592
id: BuildVersion
593-
uses: splunk/addonfactory-get-splunk-package-version-action@v1
594-
with:
595-
SemVer: ${{ steps.semantic.outputs.new_release_version }}
596-
PrNumber: ${{ github.event.number }}
593+
run: |
594+
INPUT_SEMVER="${{ steps.semantic.outputs.new_release_version }}"
595+
echo "Initial semver ${INPUT_SEMVER}"
596+
INPUT_PRNUMBER="${{ github.event.number }}"
597+
SEMVER_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+$'
598+
BETA_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$'
599+
echo working with version $INPUT_SEMVER
600+
if [[ $INPUT_SEMVER =~ $SEMVER_REGEX ]];
601+
then
602+
echo using provided semver
603+
VERSION=$INPUT_SEMVER
604+
elif [[ $INPUT_SEMVER =~ $BETA_REGEX ]];
605+
then
606+
VERSION=$(echo $INPUT_SEMVER | awk '{gsub("-beta\.", "-B");print}')
607+
else
608+
if [[ $GITHUB_EVENT_NAME != 'pull_request' ]];
609+
then
610+
echo this is not a release build and NOT PR RUNID + run ID
611+
VERSION=0.0.${GITHUB_RUN_ID}
612+
else
613+
echo this is not a release build and is a PR use run ID
614+
VERSION=0.${INPUT_PRNUMBER}.${GITHUB_RUN_ID}
615+
fi
616+
fi
617+
FINALVERSION="${VERSION//v}"
618+
echo "Version to build is ${FINALVERSION}"
619+
echo "VERSION=${FINALVERSION}" >> "$GITHUB_OUTPUT"
597620
- name: Download THIRDPARTY
598621
if: github.event_name != 'pull_request' && github.event_name != 'schedule'
599622
uses: actions/download-artifact@v3
@@ -721,10 +744,34 @@ jobs:
721744
env:
722745
GITHUB_TOKEN: ${{ github.token }}
723746
- id: BuildVersion
724-
uses: splunk/addonfactory-get-splunk-package-version-action@v1
725-
with:
726-
SemVer: ${{ steps.semantic.outputs.new_release_version }}
727-
PrNumber: ${{ github.event.number }}
747+
run: |
748+
INPUT_SEMVER="${{ steps.semantic.outputs.new_release_version }}"
749+
echo "Initial semver ${INPUT_SEMVER}"
750+
INPUT_PRNUMBER="${{ github.event.number }}"
751+
SEMVER_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+$'
752+
BETA_REGEX='^v?[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$'
753+
echo working with version $INPUT_SEMVER
754+
755+
if [[ $INPUT_SEMVER =~ $SEMVER_REGEX ]];
756+
then
757+
echo using provided semver
758+
VERSION=$INPUT_SEMVER
759+
elif [[ $INPUT_SEMVER =~ $BETA_REGEX ]];
760+
then
761+
VERSION=$(echo $INPUT_SEMVER | awk '{gsub("-beta\.", "-B");print}')
762+
else
763+
if [[ $GITHUB_EVENT_NAME != 'pull_request' ]];
764+
then
765+
echo this is not a release build and NOT PR RUNID + run ID
766+
VERSION=0.0.${GITHUB_RUN_ID}
767+
else
768+
echo this is not a release build and is a PR use run ID
769+
VERSION=0.${INPUT_PRNUMBER}.${GITHUB_RUN_ID}
770+
fi
771+
fi
772+
FINALVERSION="${VERSION//v}"
773+
echo "Version to build is $FINALVERSION"
774+
echo "VERSION=$FINALVERSION" >> "$GITHUB_OUTPUT"
728775
- id: uccgen
729776
uses: splunk/addonfactory-ucc-generator-action@v2
730777
with:

0 commit comments

Comments
 (0)