Update release.yml #25
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: Cache Python dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.virtualenvs | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Install NSIS (for creating installer) | |
run: choco install nsis -y | |
- name: Build Portable Version with Nuitka | |
run: | | |
echo 'yes' | python -m nuitka --onefile main.py --enable-plugin=tk-inter --jobs=12 --remove-output --standalone --windows-icon-from-ico=./assets/icon.ico --output-filename=SmoothedScroll_Portable --include-data-dir=./assets=./assets --include-plugin-files="assets/*" --windows-disable-console --file-description="Smooth Scrolling for all Windows apps" --product-name="Smoothed Scroll" --company-name="Zachey" --product-version="1.0.${{ github.run_number }}" --file-version="1.0.${{ github.run_number }}" | |
- name: Create Setup Script for NSIS | |
run: | | |
echo 'OutFile "SmoothedScroll_Setup.exe"' > setup_script.nsi | |
echo 'InstallDir "$PROGRAMFILES\\SmoothedScroll"' >> setup_script.nsi | |
echo 'RequestExecutionLevel user' >> setup_script.nsi | |
echo 'Page license "${{ github.workspace }}\\LICENSE"' >> setup_script.nsi | |
echo 'Page directory' >> setup_script.nsi | |
echo 'Page instfiles' >> setup_script.nsi | |
echo 'Section ""' >> setup_script.nsi | |
echo ' SetOutPath "$INSTDIR"' >> setup_script.nsi | |
echo ' File "SmoothedScroll_Portable.exe"' >> setup_script.nsi | |
echo ' File "LICENSE"' >> setup_script.nsi | |
echo ' CreateShortcut "$DESKTOP\\SmoothedScroll.lnk" "$INSTDIR\\SmoothedScroll_Portable.exe"' >> setup_script.nsi | |
echo 'SectionEnd' >> setup_script.nsi | |
echo 'Section "Uninstall"' >> setup_script.nsi | |
echo ' Delete "$INSTDIR\\SmoothedScroll_Portable.exe"' >> setup_script.nsi | |
echo ' Delete "$INSTDIR\\LICENSE"' >> setup_script.nsi | |
echo ' Delete "$DESKTOP\\SmoothedScroll.lnk"' >> setup_script.nsi | |
echo ' RMDir "$INSTDIR"' >> setup_script.nsi | |
echo 'SectionEnd' >> setup_script.nsi | |
echo '!include "MUI2.nsh"' >> setup_script.nsi | |
echo 'Name "Smoothed Scroll"' >> setup_script.nsi | |
echo 'Icon "assets/icon.ico"' >> setup_script.nsi | |
- name: Build Setup Version with NSIS | |
run: makensis setup_script.nsi | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v1.0.${{ github.run_number }} | |
release_name: "Release v1.0.${{ github.run_number }}" | |
body: "Automatic release v1.0.${{ github.run_number }}" | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Portable Version | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./SmoothedScroll_Portable.exe | |
asset_name: SmoothedScroll_Portable.exe | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Setup Version | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./SmoothedScroll_Setup.exe | |
asset_name: SmoothedScroll_Setup.exe | |
asset_content_type: application/octet-stream | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |