Skip to content

Commit 071f586

Browse files
authored
Use the matrix
1 parent 0210194 commit 071f586

File tree

1 file changed

+32
-64
lines changed

1 file changed

+32
-64
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,30 @@ name: Build application
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76
pull_request:
8-
branches:
9-
- main
7+
branches: [main]
108

119
jobs:
12-
build-windows:
13-
runs-on: windows-latest
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4.2.2
17-
18-
- name: Set up Python
19-
uses: actions/setup-python@v5.5.0
20-
with:
21-
python-version: '3.9'
22-
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install -r requirements.txt
27-
28-
- name: Build Windows
29-
run: |
30-
pyinstaller --onefile --name AutoclickerX.exe --icon=assets/logo_mouse.ico --version-file=version.txt --noconsole --clean --onefile main.py
10+
build:
11+
name: Build ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
include:
16+
- os: windows-latest
17+
artifact_name: AutoclickerX-Windows
18+
output_path: dist/AutoclickerX.exe
19+
output_name: AutoclickerX.exe
20+
- os: ubuntu-latest
21+
artifact_name: AutoclickerX-Linux
22+
output_path: dist/AutoclickerX
23+
output_name: AutoclickerX
24+
- os: macos-latest
25+
artifact_name: AutoclickerX-macOS
26+
output_path: dist/AutoclickerX
27+
output_name: AutoclickerX
3128

32-
- name: Upload Windows Build Artifact
33-
uses: actions/upload-artifact@v4.6.2
34-
with:
35-
name: AutoclickerX-Windows
36-
path: dist/AutoclickerX.exe
37-
38-
build-linux:
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Checkout code
42-
uses: actions/checkout@v4.2.2
43-
44-
- name: Set up Python
45-
uses: actions/setup-python@v5.5.0
46-
with:
47-
python-version: '3.9'
48-
49-
- name: Install dependencies
50-
run: |
51-
sudo apt update
52-
pip install -r requirements.txt
53-
54-
- name: Build Linux
55-
run: |
56-
pyinstaller --onefile --name AutoclickerX --icon=assets/logo_mouse.ico --version-file=version.txt --noconsole --clean --onefile main.py
57-
58-
- name: Upload Linux Build Artifact
59-
uses: actions/upload-artifact@v4.6.2
60-
with:
61-
name: AutoclickerX-Linux
62-
path: dist/AutoclickerX
63-
64-
build-macos:
65-
runs-on: macos-latest
6629
steps:
6730
- name: Checkout code
6831
uses: actions/checkout@v4.2.2
@@ -74,27 +37,32 @@ jobs:
7437

7538
- name: Install dependencies
7639
run: |
40+
if [[ "${{ runner.os }}" == "Linux" ]]; then sudo apt update; fi
41+
python -m pip install --upgrade pip
7742
pip install -r requirements.txt
43+
shell: bash
7844

79-
- name: Build macOS
45+
- name: Build executable
8046
run: |
81-
pyinstaller --onefile --name AutoclickerX --icon=assets/logo_mouse.ico --version-file=version.txt --noconsole --clean --onefile main.py
47+
pyinstaller --onefile --name ${{ matrix.output_name }} --icon=assets/logo_mouse.ico --version-file=version.txt --noconsole --clean main.py
48+
shell: bash
8249

83-
- name: Upload macOS Build Artifact
50+
- name: Upload Build Artifact
8451
uses: actions/upload-artifact@v4.6.2
8552
with:
86-
name: AutoclickerX-macOS
87-
path: dist/AutoclickerX
53+
name: ${{ matrix.artifact_name }}
54+
path: ${{ matrix.output_path }}
8855

8956
release:
90-
needs: [build-windows, build-linux, build-macos]
57+
name: Create Release
58+
needs: build
9159
runs-on: ubuntu-latest
9260
steps:
9361
- name: Download all build artifacts
9462
uses: actions/download-artifact@v4.1.7
9563
with:
9664
path: artifacts
97-
65+
9866
- name: Create GitHub Release with Assets
9967
uses: softprops/action-gh-release@v2
10068
with:

0 commit comments

Comments
 (0)