2025-02-08 22:04:14 +08:00

132 lines
3.6 KiB
YAML

name: Build Release
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-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Build
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
chmod +x build.sh
./build.sh
- name: Rename artifact
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.version }}
fi
mv dist/* "dist/CursorFreeVIP_${VERSION}_linux"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cursor-linux
path: dist/CursorFreeVIP*
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Build
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
cmd /c build.bat
- name: Rename artifact
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.version }}
fi
mv dist/*.exe "dist/CursorFreeVIP_${VERSION}_windows.exe"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cursor-windows
path: dist/CursorFreeVIP*
build-macos:
name: Build MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Build
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
chmod +x build.mac.command
./build.mac.command
- name: Rename artifact
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.version }}
fi
mv dist/* "dist/CursorFreeVIP_${VERSION}_mac"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cursor-macos
path: dist/CursorFreeVIP*
create-release:
needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release archives
run: |
cd artifacts
zip -r cursor-linux.zip cursor-linux/
zip -r cursor-windows.zip cursor-windows/
zip -r cursor-macos.zip cursor-macos/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/cursor-linux.zip
artifacts/cursor-windows.zip
artifacts/cursor-macos.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}