name: Build Release on: workflow_dispatch: inputs: version: description: 'Version number (without v prefix)' required: true default: '1.0.0' 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 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: | 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 }}