2025-02-08 22:12:17 +08:00

160 lines
3.8 KiB
YAML

name: Build Executables
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version number (without v prefix)'
required: true
default: '1.0.0'
permissions:
contents: write
actions: write
packages: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build EXE
run: |
pyinstaller build.spec
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: CursorFreeVIP-Windows
path: dist/CursorFreeVIP.exe
build-macos-arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build MacOS ARM executable
run: |
pyinstaller build.spec
- name: Upload MacOS ARM artifact
uses: actions/upload-artifact@v4
with:
name: CursorFreeVIP-MacOS-ARM64
path: dist/CursorFreeVIP
build-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build Linux executable
run: |
pyinstaller build.spec
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: CursorFreeVIP-Linux
path: dist/CursorFreeVIP
build-macos-intel:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
arch -x86_64 pip3 install --upgrade pip
arch -x86_64 pip3 install pyinstaller
arch -x86_64 pip3 install -r requirements.txt
- name: Build MacOS Intel executable
env:
TARGET_ARCH: 'x86_64'
run: |
arch -x86_64 python3 -m PyInstaller build.spec
- name: Upload MacOS Intel artifact
uses: actions/upload-artifact@v4
with:
name: CursorFreeVIP-MacOS-Intel
path: dist/CursorFreeVIP
create-release:
needs: [build-windows, build-macos-arm64, build-linux, build-macos-intel]
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release archives
run: |
cd artifacts
zip -r CursorFreeVIP-Windows.zip CursorFreeVIP-Windows/
zip -r CursorFreeVIP-MacOS-ARM64.zip CursorFreeVIP-MacOS-ARM64/
zip -r CursorFreeVIP-Linux.zip CursorFreeVIP-Linux/
zip -r CursorFreeVIP-MacOS-Intel.zip CursorFreeVIP-MacOS-Intel/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/CursorFreeVIP-Windows.zip
artifacts/CursorFreeVIP-MacOS-ARM64.zip
artifacts/CursorFreeVIP-Linux.zip
artifacts/CursorFreeVIP-MacOS-Intel.zip
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}