From b61b61c60714f903faeaacdbdeadae5a297f615b Mon Sep 17 00:00:00 2001 From: yeongpin Date: Sat, 8 Feb 2025 21:57:44 +0800 Subject: [PATCH] add workflow --- .github/workflows/build.yml | 92 +++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f48104e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,92 @@ +name: Build Release + +on: + push: + tags: + - 'v*' + +jobs: + build: + strategy: + matrix: + 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: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Get version from tag + id: get_version + shell: bash + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Make scripts executable (Unix) + if: runner.os != 'Windows' + run: | + chmod +x ${{ matrix.build_script }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Build + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + cmd /c ${{ matrix.build_script }} + else + ./${{ matrix.build_script }} + 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" + fi + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.artifact_name }} + path: dist/* + + create-release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download all artifacts + uses: actions/download-artifact@v3 + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + CursorFreeVIP_linux/* + CursorFreeVIP_mac/* + CursorFreeVIP_windows.exe/* + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file