Build and Upload TOsk Binary #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build and Upload TOsk Binary" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version tag (e.g., v1.0.6)" | |
| required: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Explicitly grant write permissions | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v3 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: "Install system dependencies" | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-venv | |
| - name: "Set up virtual environment and install dependencies" | |
| run: | | |
| python3 -m venv venv | |
| ./venv/bin/pip install --upgrade pip | |
| ./venv/bin/pip install -r requirements.txt | |
| - name: "Debug: List venv/bin contents" | |
| run: ls -l venv/bin | |
| - name: "Build binary with PyInstaller" | |
| run: | | |
| ./venv/bin/python -m PyInstaller --onefile \ | |
| --add-data "bin/viu:bin" \ | |
| --add-data "tosk.jpg:." \ | |
| main.py | |
| mv dist/main dist/tosk-linux-x86_64 | |
| - name: "Create Git tag" | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git tag -a ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }}" | |
| git push origin ${{ github.event.inputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Upload TOsk Binary to Release" | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: "dist/tosk-linux-x86_64" | |
| tag: ${{ github.event.inputs.version }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| allowUpdates: true | |
| generateReleaseNotes: true |