fix: add contents:write permission, PYTHONUTF8=1 for Windows encoding #2
Workflow file for this run
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 Cross-Platform Binaries | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact_name: IPGEO-Query | |
| asset_name: IPGEO-Query-linux-x64 | |
| - os: windows-latest | |
| artifact_name: IPGEO-Query.exe | |
| asset_name: IPGEO-Query-windows-x64.exe | |
| - os: macos-latest | |
| artifact_name: IPGEO-Query.app | |
| asset_name: IPGEO-Query-macos-x64.zip | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-tk | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install -r requirements.txt || true | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| env: | |
| PYTHONUTF8: "1" | |
| run: python build.py | |
| - name: Build (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| env: | |
| PYTHONUTF8: "1" | |
| run: | | |
| chmod +x build.sh | |
| ./build.sh | |
| # Prepare release asset: rename or zip the build output | |
| - name: Prepare release asset (Linux) | |
| if: runner.os == 'Linux' | |
| run: cp dist/IPGEO-Query ${{ matrix.asset_name }} | |
| - name: Prepare release asset (Windows) | |
| if: runner.os == 'Windows' | |
| run: copy dist\IPGEO-Query.exe ${{ matrix.asset_name }} | |
| - name: Prepare release asset (macOS) | |
| if: runner.os == 'macOS' | |
| run: cd dist && zip -r ../${{ matrix.asset_name }} IPGEO-Query.app && cd .. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.asset_name }} | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: ${{ matrix.asset_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |