From 54ecf2d752833211bc8ead01d1150a2093d18c8e Mon Sep 17 00:00:00 2001 From: yeongpin Date: Mon, 10 Mar 2025 16:28:26 +0800 Subject: [PATCH] feat: Add Linux ARM64 Support and Update Build Workflow - Extend GitHub Actions workflow to build Linux x64 and ARM64 executables - Update install script to detect Linux architecture (x64 or ARM64) - Modify release process to include both Linux architecture artifacts - Rename Linux build job to clarify x64 architecture --- .github/workflows/build.yml | 51 +++++++++++++++++++++++++++++++------ scripts/install.sh | 25 +++++++++++++++--- 2 files changed, 64 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fe9fe9..c5f847d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,7 +98,7 @@ jobs: name: CursorFreeVIP_${{ env.VERSION }}_mac_arm64 path: dist/CursorFreeVIP_${{ env.VERSION }}_mac_arm64 - build-linux: + build-linux-x64: needs: create-tag runs-on: ubuntu-22.04 @@ -120,20 +120,55 @@ jobs: pip install pyinstaller pip install -r requirements.txt - - name: Build Linux executable + - name: Build Linux x64 executable env: VERSION: ${{ env.VERSION }} run: | pyinstaller build.spec + mv "dist/CursorFreeVIP_${{ env.VERSION }}_linux" "dist/CursorFreeVIP_${{ env.VERSION }}_linux_x64" echo "Contents of dist directory:" ls -la dist/ - - name: Upload Linux artifact + - name: Upload Linux x64 artifact uses: actions/upload-artifact@v4 with: - name: CursorFreeVIP_${{ env.VERSION }}_linux - path: dist/CursorFreeVIP_${{ env.VERSION }}_linux + name: CursorFreeVIP_${{ env.VERSION }}_linux_x64 + path: dist/CursorFreeVIP_${{ env.VERSION }}_linux_x64 + build-linux-arm64: + needs: create-tag + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 + + - name: Set version + shell: bash + run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV + + - name: Build in ARM64 Docker container + run: | + docker run --rm --platform linux/arm64 -v ${{ github.workspace }}:/app -w /app arm64v8/python:3.9-slim bash -c " + apt-get update && apt-get install -y build-essential + pip install --upgrade pip + pip install pyinstaller + pip install -r requirements.txt + python -m PyInstaller build.spec + mv /app/dist/CursorFreeVIP_${{ env.VERSION }}_linux /app/dist/CursorFreeVIP_${{ env.VERSION }}_linux_arm64 + " + echo "Contents of dist directory:" + ls -la dist/ + + - name: Upload Linux ARM64 artifact + uses: actions/upload-artifact@v4 + with: + name: CursorFreeVIP_${{ env.VERSION }}_linux_arm64 + path: dist/CursorFreeVIP_${{ env.VERSION }}_linux_arm64 build-macos-intel: needs: create-tag @@ -171,9 +206,8 @@ jobs: name: CursorFreeVIP_${{ env.VERSION }}_mac_intel path: dist/CursorFreeVIP_${{ env.VERSION }}_mac_intel - create-release: - needs: [build-windows, build-macos-arm64, build-linux, build-macos-intel] + needs: [build-windows, build-macos-arm64, build-linux-x64, build-linux-arm64, build-macos-intel] runs-on: ubuntu-22.04 steps: @@ -201,7 +235,8 @@ jobs: files: | artifacts/CursorFreeVIP_${{ env.VERSION }}_windows.exe/CursorFreeVIP_${{ env.VERSION }}_windows.exe artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_arm64/CursorFreeVIP_${{ env.VERSION }}_mac_arm64 - artifacts/CursorFreeVIP_${{ env.VERSION }}_linux/CursorFreeVIP_${{ env.VERSION }}_linux + artifacts/CursorFreeVIP_${{ env.VERSION }}_linux_x64/CursorFreeVIP_${{ env.VERSION }}_linux_x64 + artifacts/CursorFreeVIP_${{ env.VERSION }}_linux_arm64/CursorFreeVIP_${{ env.VERSION }}_linux_arm64 artifacts/CursorFreeVIP_${{ env.VERSION }}_mac_intel/CursorFreeVIP_${{ env.VERSION }}_mac_intel draft: false prerelease: false diff --git a/scripts/install.sh b/scripts/install.sh index c8cd6d7..856f13d 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -63,8 +63,15 @@ detect_os() { echo -e "${CYAN}ℹ️ Detected macOS Intel architecture${NC}" fi elif [[ "$(uname)" == "Linux" ]]; then - OS="linux" - echo -e "${CYAN}ℹ️ Detected Linux system${NC}" + # Detect Linux architecture + ARCH=$(uname -m) + if [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then + OS="linux_arm64" + echo -e "${CYAN}ℹ️ Detected Linux ARM64 architecture${NC}" + else + OS="linux_x64" + echo -e "${CYAN}ℹ️ Detected Linux x64 architecture${NC}" + fi else # Assume Windows OS="windows" @@ -127,9 +134,19 @@ install_cursor_free_vip() { echo -e "${RED}❌ New download link does not exist${NC}" exit 1 fi - else + } elif [[ "$OS" == "linux_x64" || "$OS" == "linux_arm64" ]]; then + OS="linux" + binary_name="CursorFreeVIP_${VERSION}_${OS}" + download_url="https://github.com/yeongpin/cursor-free-vip/releases/download/v${VERSION}/${binary_name}" + echo -e "${CYAN}ℹ️ New download link: ${download_url}${NC}" + + if ! curl --output /dev/null --silent --head --fail "$download_url"; then + echo -e "${RED}❌ New download link does not exist${NC}" + exit 1 + fi + } else { exit 1 - fi + } fi # Download file