Skip to content

Commit

Permalink
Merge pull request #3 from renxida/new-ci
Browse files Browse the repository at this point in the history
Fix problems in new ci where there's some janky python-in-yaml problems
  • Loading branch information
renxida authored Jun 28, 2024
2 parents 6fe076e + c68bfeb commit fb260f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
prerelease: true
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fb260f1

Please sign in to comment.