-
Notifications
You must be signed in to change notification settings - Fork 11
138 lines (119 loc) · 3.72 KB
/
pyinstaller.yml
File metadata and controls
138 lines (119 loc) · 3.72 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
name: Client Build
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
release:
types: [created]
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
artifact_name: pn532_cli_release_linux
- os: windows-latest
artifact_name: pn532_cli_release_windows
- os: macos-latest
artifact_name: pn532_cli_release_macos
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install MSYS2 toolchain
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
mingw-w64-x86_64-toolchain
path-type: inherit
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r script/requirements.txt
pip install pyinstaller
- name: Build mfkey tools (Linux/macOS)
if: runner.os != 'Windows'
run: |
chmod +x script/build_helpers.sh
./script/build_helpers.sh
- name: Build mfkey tools (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
env:
CC: gcc
run: |
chmod +x script/build_helpers.sh
./script/build_helpers.sh
- name: Run PyInstaller
run: |
pyinstaller script/pyinstaller.spec
- name: Bundle mfkey binaries (Linux/macOS)
if: runner.os != 'Windows'
run: |
mkdir -p dist/pn532_cli_main/mfkey
cp build/mfkey32v2 build/mfkey64 build/staticnested dist/pn532_cli_main/mfkey/
- name: Bundle mfkey binaries (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "dist/pn532_cli_main/mfkey" | Out-Null
Copy-Item -Path "build/mfkey32v2","build/mfkey64","build/staticnested" -Destination "dist/pn532_cli_main/mfkey" -Force
- name: Package artifact (Linux)
if: runner.os == 'Linux'
run: |
zip -r "${{ matrix.artifact_name }}.zip" dist/*
- name: Package artifact (macOS)
if: runner.os == 'macOS'
run: |
zip -r "${{ matrix.artifact_name }}.zip" dist/*
- name: Package artifact (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "dist/*" -DestinationPath "${{ matrix.artifact_name }}.zip"
- name: Upload artifacts (zip only)
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}.zip
prerelease:
name: Create prerelease and attach builds
needs: build
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
steps:
- name: Compute short SHA
id: vars
run: echo "short_sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
pattern: '*'
merge-multiple: true
path: release-assets
- name: Create GitHub prerelease and upload assets
uses: softprops/action-gh-release@v2
with:
tag_name: beta.${{ steps.vars.outputs.short_sha }}
name: PN532 CLI - beta.${{ steps.vars.outputs.short_sha }}
prerelease: true
draft: false
body: |
Auto-generated beta prerelease for commit ${{ github.sha }}.
This release contains PyInstaller builds for Linux, Windows, and macOS.
files: |
release-assets/*.zip