Fix problems in new ci where there's some janky python-in-yaml problems #4
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
# File: .github/workflows/nightly-release.yml | |
name: Nightly Release | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
create-nightly: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install semver | |
- name: Determine nightly version | |
id: version | |
run: | | |
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 | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: nightly-v${{ steps.version.outputs.nightly_version }} | |
release_name: Nightly Release ${{ steps.version.outputs.nightly_version }} | |
draft: false | |
prerelease: true |