diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml index 7e87e4c..187360e 100644 --- a/.github/workflows/nightly-release.yml +++ b/.github/workflows/nightly-release.yml @@ -29,18 +29,14 @@ jobs: - name: Determine nightly version id: version run: | - current_version=$(python -c " - import re - with open('uniclip/__init__.py', 'r') as f: - content = f.read() - match = re.search(r\"__version__\s*=\s*['\\\"]([^'\\\"]*)['\\\"]\", content) - if match: - print(match.group(1)) - else: - print('0.0.0') # fallback version - ") - nightly_version=$(python -c "import semver; v = semver.VersionInfo.parse('$current_version'); print(f'{v.major}.{v.minor}.{v.patch}-nightly.{github.run_number}')") + current_version=$(grep -oP "__version__\s*=\s*['\"]?\K[^'\"']+" uniclip/__init__.py || echo "0.0.0") + IFS='.' read -r major minor patch <<< "$current_version" + prerelease=$(echo "$patch" | grep -oP '[-+].*$' || echo "") + patch=$(echo "$patch" | grep -oP '^\d+' || echo "0") + nightly_version="${major}.${minor}.${patch}-nightly.${GITHUB_RUN_NUMBER}${prerelease}" echo "nightly_version=$nightly_version" >> "$GITHUB_OUTPUT" + echo "Current version: $current_version" + echo "Nightly version: $nightly_version" - name: Create Nightly Release id: create_release @@ -51,4 +47,4 @@ jobs: tag_name: nightly-v${{ steps.version.outputs.nightly_version }} release_name: Nightly Release ${{ steps.version.outputs.nightly_version }} draft: false - prerelease: true \ No newline at end of file + prerelease: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47a69ee..29e4c8e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,4 +70,4 @@ jobs: git config --local user.name "GitHub Action" git add README.md git commit -m "Update version in README to ${{ steps.version.outputs.official_version }}" - git push + git push \ No newline at end of file