update reissue

This commit is contained in:
yeongpin 2025-02-08 22:04:14 +08:00
parent 69994d2486
commit 4166bc5135

View File

@ -1,102 +1,131 @@
name: Build Release name: Build Release
on: on:
push:
tags:
- 'v*'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: 'Version number (without v prefix)' description: 'Version number (without v prefix)'
required: true required: true
default: '1.0.0' default: '1.0.0'
push:
tags: permissions:
- 'v*' contents: write
actions: write
packages: write
jobs: jobs:
build: build-linux:
strategy: name: Build Linux
matrix: runs-on: ubuntu-latest
include:
- os: ubuntu-latest
build_script: build.sh
artifact_name: CursorFreeVIP_linux
- os: macos-latest
build_script: build.mac.command
artifact_name: CursorFreeVIP_mac
- os: windows-latest
build_script: build.bat
artifact_name: CursorFreeVIP_windows.exe
runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout code - uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v5 uses: actions/setup-python@v3
with: with:
python-version: '3.10' python-version: '3.10'
- name: Build
- name: Get version
id: get_version
shell: bash
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
else
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
fi
- name: Make scripts executable (Unix)
if: runner.os != 'Windows'
run: |
chmod +x ${{ matrix.build_script }}
- name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
chmod +x build.sh
- name: Build ./build.sh
- name: Rename artifact
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then VERSION=${GITHUB_REF#refs/tags/v}
cmd /c ${{ matrix.build_script }} if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
else VERSION=${{ github.event.inputs.version }}
./${{ matrix.build_script }}
fi fi
shell: bash
- name: Rename artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
mv dist/*.exe "dist/CursorFreeVIP_${VERSION}_windows.exe"
elif [ "$RUNNER_OS" == "macOS" ]; then
mv dist/* "dist/CursorFreeVIP_${VERSION}_mac"
else
mv dist/* "dist/CursorFreeVIP_${VERSION}_linux" mv dist/* "dist/CursorFreeVIP_${VERSION}_linux"
fi - name: Upload Artifact
- name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ matrix.artifact_name }} name: cursor-linux
path: dist/* 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: create-release:
needs: build needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps: steps:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v4 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 - name: Create Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: | files: |
CursorFreeVIP_linux/* artifacts/cursor-linux.zip
CursorFreeVIP_mac/* artifacts/cursor-windows.zip
CursorFreeVIP_windows.exe/* artifacts/cursor-macos.zip
draft: false draft: false
prerelease: false prerelease: false
env: env: