File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 2525 - name : Get Release Version
2626 id : get_version
2727 run : VERSION=$(./gradlew currentVersion -q -Prelease.quiet) && echo ::set-output name=VERSION::$VERSION
28+ - name : Update Fallback Version in Main Branch
29+ run : |
30+ # Create a temporary branch from main to update the fallback version
31+ git fetch origin main
32+ git checkout main
33+ git pull origin main
34+
35+ echo "Updating fallback version to ${{ steps.get_version.outputs.VERSION }}"
36+ echo "# Fallback version for CI environments where Git history is not available" > gradle.properties
37+ echo "# This is automatically updated during the release process" >> gradle.properties
38+ echo "fallback.version=${{ steps.get_version.outputs.VERSION }}" >> gradle.properties
39+
40+ # Check if there are changes to commit
41+ if ! git diff --quiet gradle.properties; then
42+ git config --local user.email "[email protected] " 43+ git config --local user.name "GitHub Action"
44+ git add gradle.properties
45+ git commit -m "Update fallback version to ${{ steps.get_version.outputs.VERSION }} [skip ci]"
46+ git push origin main
47+ echo "Updated fallback version in main branch"
48+ else
49+ echo "No changes needed to gradle.properties"
50+ fi
51+
52+ # Switch back to the tag for the rest of the release process
53+ git checkout ${{ github.ref_name }}
2854 - name : Create Release
2955 id : create_release
3056 run : |
Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ scmVersion {
3636 }
3737}
3838
39- project. version = scmVersion. version
39+ // Use a fixed version in CI environments where Git history may be incomplete
40+ if (System . getenv(" CI" ) || System . getenv(" GITHUB_ACTIONS" )) {
41+ project. version = project. property(' fallback.version' )
42+ println " CI environment detected, using fallback version: ${ project.version} "
43+ } else {
44+ project. version = scmVersion. version
45+ }
4046
4147/**
4248 * Set this to a comma-separated list of full classnames of your implemented Rundeck
Original file line number Diff line number Diff line change 1+ # Fallback version for CI environments where Git history is not available
2+ # This should be updated automatically during the release process
3+ fallback.version =1.1.5
You can’t perform that action at this time.
0 commit comments