-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add publish for custom version
- Loading branch information
1 parent
e3a7bc1
commit bfcf32a
Showing
1 changed file
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ on: | |
type: string | ||
default: >- | ||
[""] | ||
custom-version: | ||
required: false | ||
description: 'Version of release specified by user instead of semantic release' | ||
type: string | ||
default: "" | ||
k8s-environment: | ||
required: false | ||
description: Specifies which environment to use for k8s testing. ["production", "staging"] | ||
|
@@ -127,7 +132,7 @@ jobs: | |
EXECUTE_LABELED["$test_type"]="true" | ||
fi | ||
done | ||
elif ${{ github.base_ref == 'main' }} || ${{ contains(github.event.pull_request.labels.*.name, 'execute_all_tests') }}; then | ||
elif ${{ github.base_ref == 'main' }} || ${{ github.ref_name == 'develop' }} || ${{ contains(github.event.pull_request.labels.*.name, 'execute_all_tests') }}; then | ||
for test_type in "${TESTSET[@]}"; do | ||
EXECUTE_LABELED["$test_type"]="true" | ||
done | ||
|
@@ -151,6 +156,13 @@ jobs: | |
EXECUTE_LABELED["$test_type"]="true" | ||
done | ||
;; | ||
"workflow_dispatch") | ||
if ${{ inputs.custom-version != '' }} ; then | ||
for test_type in "${TESTSET[@]}"; do | ||
EXECUTE_LABELED["$test_type"]="true" | ||
done | ||
fi | ||
;; | ||
*) | ||
echo "No tests were labeled for execution!" | ||
;; | ||
|
@@ -495,7 +507,7 @@ jobs: | |
- name: Determine the version to build | ||
id: BuildVersion | ||
run: | | ||
INPUT_SEMVER="${{ steps.semantic.outputs.new_release_version }}" | ||
INPUT_SEMVER="${{ github.event.inputs.custom-version != '' && github.event.inputs.custom-version || 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]+$' | ||
|
@@ -673,7 +685,7 @@ jobs: | |
GITHUB_TOKEN: ${{ github.token }} | ||
- id: BuildVersion | ||
run: | | ||
INPUT_SEMVER="${{ steps.semantic.outputs.new_release_version }}" | ||
INPUT_SEMVER="${{ github.event.inputs.custom-version != '' && github.event.inputs.custom-version || 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]+$' | ||
|
@@ -785,7 +797,7 @@ jobs: | |
if: | | ||
!cancelled() && | ||
needs.build.result == 'success' && | ||
( github.base_ref == 'main' || github.ref_name == 'main' ) | ||
( github.base_ref == 'main' || github.ref_name == 'main' || github.ref_name == 'develop') | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
@@ -1819,7 +1831,7 @@ jobs: | |
${{ needs.setup.outputs.directory-path }}/diag* | ||
run-scripted-input-tests-full-matrix: | ||
if: ${{ !cancelled() && needs.build.result == 'success' && needs.test-inventory.outputs.scripted_inputs == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' ) && needs.setup-workflow.outputs.execute-scripted_inputs-labeled == 'true' }} | ||
if: ${{ !cancelled() && needs.build.result == 'success' && needs.test-inventory.outputs.scripted_inputs == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' || github.ref_name == 'develop') && needs.setup-workflow.outputs.execute-scripted_inputs-labeled == 'true' }} | ||
needs: | ||
- build | ||
- test-inventory | ||
|
@@ -2086,7 +2098,9 @@ jobs: | |
exit 1 | ||
publish: | ||
if: ${{ !cancelled() && needs.pre-publish.result == 'success' && github.event_name != 'pull_request' && github.event_name != 'schedule' }} | ||
if: ${{ !cancelled() && needs.pre-publish.result == 'success' && github.event_name != 'pull_request' && github.event_name != 'schedule' || github.event.inputs.custom-version != '' }} | ||
name: ${{ github.event.inputs.custom-version == '' && 'publish' || 'publish-custom-version' }} | ||
|
||
needs: | ||
- pre-publish | ||
runs-on: ubuntu-latest | ||
|
@@ -2102,6 +2116,7 @@ jobs: | |
submodules: false | ||
persist-credentials: false | ||
- name: Semantic Release | ||
if: ${{ github.event.inputs.custom-version == '' }} | ||
id: semantic | ||
uses: splunk/[email protected] | ||
env: | ||
|
@@ -2111,46 +2126,54 @@ jobs: | |
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }} | ||
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }} | ||
- name: Release custom version | ||
if: ${{ github.event.inputs.custom-version != '' }} | ||
uses: "softprops/action-gh-release@v2" | ||
with: | ||
token: "${{ secrets.GH_TOKEN_ADMIN }}" | ||
tag_name: v${{ github.event.inputs.custom-version }} | ||
target_commitish: "${{github.ref_name}}" | ||
make_latest: false | ||
- name: Download package-deployment | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' }} | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' || github.event.inputs.custom-version != ''}} | ||
uses: actions/download-artifact@v4 | ||
id: download-package-deployment | ||
with: | ||
name: package-deployment | ||
path: download/artifacts/ | ||
- name: Download package-splunkbase | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' }} | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' || github.event.inputs.custom-version != '' }} | ||
uses: actions/download-artifact@v4 | ||
id: download-package-splunkbase | ||
with: | ||
name: package-splunkbase | ||
path: download/artifacts/deployment | ||
- name: Download cim-compliance-report | ||
id: download-cim-compliance-report | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' }} | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' || github.event.inputs.custom-version != '' }} | ||
continue-on-error: true | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: cim-compliance-report | ||
path: download/artifacts/deployment | ||
- name: Download cim-field-report | ||
id: download-cim-field-report | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' }} | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' || github.event.inputs.custom-version != '' }} | ||
continue-on-error: true | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: cim-field-report | ||
path: download/artifacts/deployment | ||
- name: List of assets | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' }} | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true'|| github.event.inputs.custom-version != '' }} | ||
run: | | ||
ls -la ${{ steps.download-package-splunkbase.outputs.download-path }} | ||
- name: Upload assets to release | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' }} | ||
if: ${{ steps.semantic.outputs.new_release_published == 'true' || github.event.inputs.custom-version != '' }} | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ github.token }} | ||
file: ${{ steps.download-package-splunkbase.outputs.download-path }}/* | ||
overwrite: true | ||
file_glob: true | ||
tag: v${{ steps.semantic.outputs.new_release_version }} | ||
tag: v${{ github.event.inputs.custom-version != '' && github.event.inputs.custom-version || steps.semantic.outputs.new_release_version }} |