-
-
Notifications
You must be signed in to change notification settings - Fork 2
105 lines (91 loc) · 4.14 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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 }}