-
-
Notifications
You must be signed in to change notification settings - Fork 90
141 lines (117 loc) · 4.04 KB
/
release.yml
File metadata and controls
141 lines (117 loc) · 4.04 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
MOUSER_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
MOUSER_GIT_COMMIT: ${{ github.sha }}
MOUSER_GIT_DIRTY: "false"
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build with PyInstaller
run: pyinstaller Mouser.spec --noconfirm
- name: Create archive
run: Compress-Archive -Path dist\Mouser -DestinationPath Mouser-Windows.zip
- uses: actions/upload-artifact@v7
with:
name: Mouser-Windows
path: Mouser-Windows.zip
build-macos:
name: build-macos (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Apple Silicon
runner: macos-15
python_architecture: arm64
pyinstaller_target_arch: arm64
artifact_name: Mouser-macOS
archive_name: Mouser-macOS.zip
- name: Intel
runner: macos-15-intel
python_architecture: x64
pyinstaller_target_arch: x86_64
artifact_name: Mouser-macOS-intel
archive_name: Mouser-macOS-intel.zip
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
architecture: ${{ matrix.python_architecture }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build macOS app
env:
PYINSTALLER_TARGET_ARCH: ${{ matrix.pyinstaller_target_arch }}
run: |
chmod +x build_macos_app.sh
./build_macos_app.sh
- name: Create archive
run: cd dist && zip -r -y "../${{ matrix.archive_name }}" Mouser.app
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.archive_name }}
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libhidapi-dev
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build with PyInstaller
run: pyinstaller Mouser-linux.spec --noconfirm
- name: Create archive
run: cd dist && zip -r -y ../Mouser-Linux.zip Mouser
- uses: actions/upload-artifact@v7
with:
name: Mouser-Linux
path: Mouser-Linux.zip
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build-windows, build-macos, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" > /dev/null 2>&1; then
# Release already exists — just upload the assets
gh release upload "${{ github.ref_name }}" \
--repo "${{ github.repository }}" \
--clobber \
Mouser-Windows/Mouser-Windows.zip \
Mouser-macOS/Mouser-macOS.zip \
Mouser-macOS-intel/Mouser-macOS-intel.zip \
Mouser-Linux/Mouser-Linux.zip
else
gh release create "${{ github.ref_name }}" \
--repo "${{ github.repository }}" \
--title "Mouser ${{ github.ref_name }}" \
--generate-notes \
Mouser-Windows/Mouser-Windows.zip \
Mouser-macOS/Mouser-macOS.zip \
Mouser-macOS-intel/Mouser-macOS-intel.zip \
Mouser-Linux/Mouser-Linux.zip
fi