Update release.yml #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
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 | |
shell: pwsh | |
run: | | |
$latest_tag = git describe --tags $(git rev-list --tags --max-count=1) 2>$null | |
if (-not $latest_tag) { | |
$new_version = "1.0.0" | |
} else { | |
$version_parts = $latest_tag.TrimStart('v').Split('.') | |
$major = $version_parts[0] | |
$minor = $version_parts[1] | |
$patch = [int]$version_parts[2] + 1 | |
$new_version = "$major.$minor.$patch" | |
} | |
echo "version=$new_version" >> $env: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${{ env.version }}" | |
git push origin "v${{ env.version }}" | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.version }}" | |
release_name: "Release v${{ env.version }}" | |
draft: false | |
prerelease: false | |
- 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 |