Fix create-executables.yml workflow to upload output to release page

This commit is contained in:
Brett Williams
2026-06-06 17:32:16 -05:00
parent c38213fb58
commit 44e6b4332f
+53 -15
View File
@@ -5,6 +5,9 @@ on:
release: release:
types: [published] types: [published]
permissions:
contents: write
jobs: jobs:
build: build:
name: Build executables (${{ matrix.os }}) name: Build executables (${{ matrix.os }})
@@ -45,22 +48,57 @@ jobs:
- name: Build server - name: Build server
run: pyinstaller --clean server.spec run: pyinstaller --clean server.spec
- name: Upload client artifact - name: Package build outputs
shell: bash
env:
ARTIFACT_SUFFIX: ${{ matrix.artifact_suffix }}
run: |
python - <<'PY'
from pathlib import Path
import os
import zipfile
suffix = os.environ['ARTIFACT_SUFFIX']
dist_dir = Path('dist')
asset_dir = Path('release-assets')
asset_dir.mkdir(exist_ok=True)
for app_name in ('Zordon-client', 'Zordon-server'):
source = next(
(
path for path in (
dist_dir / f'{app_name}.exe',
dist_dir / f'{app_name}.app',
dist_dir / app_name,
)
if path.exists()
),
None,
)
if source is None:
raise FileNotFoundError(f'Could not find PyInstaller output for {app_name}')
zip_path = asset_dir / f'{app_name}-{suffix}.zip'
with zipfile.ZipFile(zip_path, 'w', compression=zipfile.ZIP_DEFLATED) as zip_file:
if source.is_dir():
for file_path in source.rglob('*'):
if file_path.is_file():
zip_file.write(file_path, source.name / file_path.relative_to(source))
else:
zip_file.write(source, source.name)
PY
- name: Upload build artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Zordon-client-${{ matrix.artifact_suffix }} name: Zordon-build-${{ matrix.artifact_suffix }}
path: | path: release-assets/*.zip
dist/Zordon-client
dist/Zordon-client.exe
dist/Zordon-client.app
if-no-files-found: error if-no-files-found: error
- name: Upload server artifact - name: Attach assets to release
uses: actions/upload-artifact@v4 if: github.event_name == 'release'
with: shell: bash
name: Zordon-server-${{ matrix.artifact_suffix }} env:
path: | GH_TOKEN: ${{ github.token }}
dist/Zordon-server run: gh release upload "${{ github.event.release.tag_name }}" release-assets/*.zip --clobber
dist/Zordon-server.exe
dist/Zordon-server.app
if-no-files-found: error