-
Notifications
You must be signed in to change notification settings - Fork 18
82 lines (72 loc) · 2.87 KB
/
build.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
name: Build Workflow for epson_print_conf.exe/zip
on:
push:
tags:
- "v*.*.*"
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0 # Fetch all history for accurate commits and tags
- name: Update VERSION in python file ui.py; commit and push updates
run: |
$filePath = "ui.py"
$VERSION = "${{ github.ref_name }}"
if ($VERSION.StartsWith('v')) {
$VERSION = $VERSION.Substring(1)
}
(Get-Content $filePath) -replace '^VERSION = ".*"$', "VERSION = `"$VERSION`"" | Set-Content $filePath
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add $filePath
git commit -m "Update VERSION to ${{ github.ref_name }}"
git remote set-url origin https://${GITHUB_USER}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push origin main
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'x64'
- name: Install Python Requirements
run: |
python -m pip install --upgrade pip
#pip install git+https://github.com/pyinstaller/pyinstaller@develop
pip install pyinstaller
pip install Pillow
pip install -r requirements.txt
- name: Run PyInstaller to create epson_print_conf.exe
run: python -m PyInstaller epson_print_conf.spec -- --default
- name: Zip the epson_print_conf.exe asset to epson_print_conf.zip
run: |
Compress-Archive dist/epson_print_conf.exe dist/epson_print_conf.zip
shell: pwsh
- name: Generate Changelog
run: >
echo "The *epson_print_conf.exe* executable file in the
*epson_print_conf.zip* archive within the assets below is
auto-generated by a [GitHub Action](.github/workflows/build.yml).
<br /><br />
Check the
[History of modifications](https://github.com/Ircama/epson_print_conf/commits/main/).
"
> ${{ github.workspace }}-CHANGELOG.txt
- name: Create Release, uploading the epson_print_conf.zip asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt
files: dist/epson_print_conf.zip
append_body: true
generate_release_notes: false
- name: Remove old releases
uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 1
keep-old-minor-releases: false
keep-old-minor-releases-count: 1
remove-tags: true