Update release.yml #5
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
name: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-release: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12.5" | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Increase Version | |
id: version | |
run: | | |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
[[ -z "$latest_tag" ]] && new_version="1.0.0" || { | |
IFS='.' read -r major minor patch <<< "${latest_tag:1}" | |
new_version="$major.$minor.$((patch + 1))" | |
} | |
echo "new_version=$new_version" >> $GITHUB_ENV | |
- name: Build with Nuitka | |
uses: Nuitka/Nuitka-Action@main | |
with: | |
main_file: main.py | |
output_dir: ./build | |
output_name: SmoothedScroll.exe | |
icon: ./assets/icon.ico | |
enable_plugin: tk-inter | |
jobs: 8 | |
standalone: true | |
onefile: true | |
remove_output: true | |
windows_disable_console: true | |
static_libpython: no | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Create and Push Tag | |
run: | | |
git tag "v$new_version" | |
git push origin "v$new_version" | |
- name: Create GitHub Release | |
run: gh release create "v$new_version" ./build/SmoothedScroll.exe --title "Release v$new_version" --notes "Release version v$new_version" | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/SmoothedScroll.exe | |
asset_name: SmoothedScroll.exe | |
asset_content_type: application/octet-stream |