Rename zip files for HM64Updater packaging #5
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 Game Updater Executables | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| python-version: [3.11] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| # --------------------------------------------- | |
| # FIX: Make version-detection work on all OSes | |
| # --------------------------------------------- | |
| - name: Determine version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| else | |
| VERSION="${GITHUB_REF#refs/heads/}" | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| # --------------------------------------------- | |
| # Build executables | |
| # --------------------------------------------- | |
| - name: Build executables | |
| shell: bash | |
| run: | | |
| set -e | |
| cd scripts | |
| rm -rf dist build __pycache__ | |
| for f in *.py; do | |
| echo "Building $f" | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| pyinstaller --onefile --noconsole "$f" | |
| else | |
| pyinstaller --onefile "$f" | |
| fi | |
| done | |
| # --------------------------------------------- | |
| # Package executables (cross-platform) | |
| # --------------------------------------------- | |
| - name: Package executables (Windows) | |
| if: runner.os == 'Windows' | |
| shell: powershell | |
| run: | | |
| $zipPath = "HM64Updater-${env:VERSION}-Windows.zip" | |
| Compress-Archive -Path "scripts/dist/*" -DestinationPath $zipPath -Force | |
| - name: Package executables (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| cd scripts/dist | |
| if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
| ZIP="../../HM64Updater-${VERSION}-Linux.zip" | |
| else | |
| ZIP="../../HM64Updater-${VERSION}-Mac.zip" | |
| fi | |
| zip -r "$ZIP" ./* | |
| # --------------------------------------------- | |
| # Upload artifact (v4) | |
| # --------------------------------------------- | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MyGameUpdater-${{ matrix.os }} | |
| path: MyGameUpdater-${{ env.VERSION }}-*.zip | |
| if-no-files-found: error |