diff --git a/.github/workflows/build-binary.yml b/.github/workflows/build-binary.yml new file mode 100644 index 0000000..70def1e --- /dev/null +++ b/.github/workflows/build-binary.yml @@ -0,0 +1,57 @@ +name: Build and Release Binary + +on: + release: + types: [published] + +jobs: + build: + strategy: + matrix: + include: + - os: ubuntu-latest + asset_name: ghosttrack-linux + executable_name: GhostTR + - os: windows-latest + asset_name: ghosttrack-windows.exe + executable_name: GhostTR.exe + - os: macos-latest + asset_name: ghosttrack-macos + executable_name: GhostTR + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pyinstaller + pip install -r requirements.txt + + - name: Build binary + run: | + pyinstaller --onefile --name GhostTR GhostTR.py + + - name: Rename binary + shell: bash + run: | + if [[ "${{ matrix.os }}" == "windows-latest" ]]; then + mv dist/GhostTR.exe dist/${{ matrix.asset_name }} + else + mv dist/GhostTR dist/${{ matrix.asset_name }} + fi + + - name: Upload binary to release + uses: softprops/action-gh-release@v2 + with: + files: dist/${{ matrix.asset_name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}