update build

This commit is contained in:
yeongpin 2025-02-08 22:45:32 +08:00
parent 638916e5ef
commit 53ab15604e

View File

@ -1,15 +1,12 @@
name: Build Executables name: Build Executables
on: on:
push:
tags:
- 'v*'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: 'Version number (without v prefix)' description: 'Version number (e.g. 1.0.9)'
required: true required: true
default: '1.0.0' default: '1.0.9'
permissions: permissions:
contents: write contents: write
@ -17,7 +14,17 @@ permissions:
packages: write packages: write
jobs: jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create Tag
run: |
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}
build-windows: build-windows:
needs: create-tag
runs-on: windows-latest runs-on: windows-latest
steps: steps:
@ -28,14 +35,9 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Get version - name: Set version
shell: bash shell: bash
run: | run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
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: Install dependencies - name: Install dependencies
run: | run: |
@ -50,10 +52,11 @@ jobs:
- name: Upload Windows artifact - name: Upload Windows artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: CursorFreeVIP-Windows name: CursorFreeVIP_${{ env.VERSION }}_windows.exe
path: dist/CursorFreeVIP_${VERSION}_windows.exe path: dist/*
build-macos-arm64: build-macos-arm64:
needs: create-tag
runs-on: macos-latest runs-on: macos-latest
steps: steps:
@ -64,6 +67,10 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Set version
shell: bash
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
@ -77,10 +84,11 @@ jobs:
- name: Upload MacOS ARM artifact - name: Upload MacOS ARM artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: CursorFreeVIP-MacOS-ARM64 name: CursorFreeVIP_${{ env.VERSION }}_mac_arm64
path: dist/CursorFreeVIP_${VERSION}_mac_arm64 path: dist/*
build-linux: build-linux:
needs: create-tag
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
@ -91,6 +99,10 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Set version
shell: bash
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
@ -104,11 +116,12 @@ jobs:
- name: Upload Linux artifact - name: Upload Linux artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: CursorFreeVIP-Linux name: CursorFreeVIP_${{ env.VERSION }}_linux
path: dist/CursorFreeVIP_${VERSION}_linux path: dist/*
build-macos-intel: build-macos-intel:
needs: create-tag
runs-on: macos-latest runs-on: macos-latest
steps: steps:
@ -119,6 +132,10 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Set version
shell: bash
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Install dependencies - name: Install dependencies
run: | run: |
arch -x86_64 pip3 install --upgrade pip arch -x86_64 pip3 install --upgrade pip
@ -134,8 +151,8 @@ jobs:
- name: Upload MacOS Intel artifact - name: Upload MacOS Intel artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: CursorFreeVIP-MacOS-Intel name: CursorFreeVIP_${{ env.VERSION }}_mac_intel
path: dist/CursorFreeVIP_${VERSION}_mac_intel path: dist/*
create-release: create-release:
@ -160,21 +177,21 @@ jobs:
- name: Prepare release files - name: Prepare release files
run: | run: |
cd artifacts cd artifacts
mv CursorFreeVIP_*_Windows/* . mv CursorFreeVIP_${{ env.VERSION }}_windows.exe/* .
mv CursorFreeVIP_*_MacOS_ARM64/* . mv CursorFreeVIP_${{ env.VERSION }}_mac_arm64/* .
mv CursorFreeVIP_*_Linux/* . mv CursorFreeVIP_${{ env.VERSION }}_linux/* .
mv CursorFreeVIP_*_MacOS_Intel/* . mv CursorFreeVIP_${{ env.VERSION }}_mac_intel/* .
rm -rf CursorFreeVIP_*_*/ rm -rf CursorFreeVIP_${{ env.VERSION }}_*/*
- name: Create Release - name: Create Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: | files: |
artifacts/CursorFreeVIP_${VERSION}_windows.exe artifacts/CursorFreeVIP_${{ env.VERSION }}_windows.exe
artifacts/CursorFreeVIP_${VERSION}_mac_arm64 artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_arm64
artifacts/CursorFreeVIP_${VERSION}_linux artifacts/CursorFreeVIP_${{ env.VERSION }}_linux
artifacts/CursorFreeVIP_${VERSION}_mac_intel artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_intel
draft: false draft: false
prerelease: false prerelease: false
env: env: