Skip to content

Release Launcher

Release Launcher #17

name: Release Launcher
on:
workflow_dispatch:
env:
python_version: '3.12'
jobs:
build-matrix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ 'ubuntu-20.04', 'macos-13', 'macos-14' ]
include:
- os: 'ubuntu-20.04'
artifact-name: 'launcher-linux-amd64'
move-command: 'mv dist/__main__ dist/launch'
zip-command: 'zip -j dist/ZenithProxy-launcher-linux-amd64.zip dist/launch'
sha1-command: 'sha1sum -b dist/launch | cut -d" " -f 1'
- os: 'macos-13'
artifact-name: 'launcher-macos-amd64'
move-command: 'mv dist/__main__ dist/launch'
zip-command: 'zip -j dist/ZenithProxy-launcher-macos-amd64.zip dist/launch'
sha1-command: 'shasum dist/launch | cut -d" " -f 1'
- os: 'macos-14'
artifact-name: 'launcher-macos-aarch64'
move-command: 'mv dist/__main__ dist/launch'
zip-command: 'zip -j dist/ZenithProxy-launcher-macos-aarch64.zip dist/launch'
sha1-command: 'shasum dist/launch | cut -d" " -f 1'
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Install PyInstaller
run: |
pip install -U pyinstaller
pip install -r ./src/launcher/requirements.txt
- name: Build launcher
run: >
pyinstaller --specpath ./build
-p ./src/launcher --onefile --noconfirm
-i ../src/launcher/icon.ico
./src/launcher/__main__.py
- name: Rename executable
run: |
${{ matrix.move-command }}
- name: Create zip
run: |
${{ matrix.zip-command }}
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: dist/ZenithProxy-${{ matrix.artifact-name }}.zip
- name: Get Binary Hash
run: ${{ matrix.sha1-command }} > ZenithProxy-${{ matrix.artifact-name }}.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}.sha1
path: ZenithProxy-${{ matrix.artifact-name }}.sha1
build-windows:
runs-on: windows-2019
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Install Dependencies
run: |
pip install -r ./src/launcher/requirements.txt
- uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: src/launcher/__main__.py
standalone: true
onefile: true
windows-icon-from-ico: src/launcher/icon.ico
output-file: "launch"
output-dir: "dist"
- name: Create zip
run: |
Compress-Archive -Path .\dist\launch.exe -DestinationPath .\dist\ZenithProxy-launcher-windows-amd64.zip
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: launcher-windows-amd64
path: dist/ZenithProxy-launcher-windows-amd64.zip
- name: Get Binary Hash
run: (Get-FileHash -Path dist\launch.exe -Algorithm sha1).Hash.ToLower() > ZenithProxy-launcher-windows-amd64.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: launcher-windows-amd64.sha1
path: ZenithProxy-launcher-windows-amd64.sha1
build-linux-aarch64:
runs-on: 'ubuntu-latest'
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build binary on emulated aarch64
run: |
docker run --rm --platform linux/arm64 --volume "${PWD}:/repo" python:${{ env.python_version }}-bullseye /bin/sh -c " \
cd /repo && \
python3 -m pip install -U pyinstaller && \
python3 -m pip install -r ./src/launcher/requirements.txt && \
pyinstaller --specpath ./build -p ./src/launcher --onefile --noconfirm ./src/launcher/__main__.py
"
- name: Rename executable
run: |
sudo mv dist/__main__ dist/launch
- name: Elevate binary permissions
run: sudo chmod +x dist/launch
- name: Create zip
run: sudo zip -j dist/ZenithProxy-launcher-linux-aarch64.zip dist/launch
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: launcher-linux-aarch64
path: dist/ZenithProxy-launcher-linux-aarch64.zip
- name: Get Binary Hash
run: sha1sum -b dist/launch | cut -d" " -f 1 > ZenithProxy-launcher-linux-aarch64.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: launcher-linux-aarch64.sha1
path: ZenithProxy-launcher-linux-aarch64.sha1
package-python:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Create Python executable zip
run: zip -j launcher-py.zip src/launcher/*.py
- name: Elevate script permissions
run: |
chmod +x src/launcher/launch.sh
- name: Create release zip
run: zip -j ZenithProxy-launcher-python.zip launcher-py.zip src/launcher/requirements.txt src/launcher/launch.sh src/launcher/launch.bat
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: launcher-python
path: ZenithProxy-launcher-python.zip
- name: Get Binary Hash
run: sha1sum -b launcher-py.zip | cut -d" " -f 1 > ZenithProxy-launcher-python.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: launcher-python.sha1
path: ZenithProxy-launcher-python.sha1
release-artifacts:
needs:
- build-matrix
- build-windows
- build-linux-aarch64
- package-python
runs-on: ubuntu-latest
steps:
- name: Download job artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts/
- name: Compile Hashes
run: |
cat artifacts/*.sha1 > hashes.txt
# - name: Publish Release Artifacts
# uses: ncipollo/release-action@v1
# with:
# tag: "launcher-v3"
# artifacts: "artifacts/*.zip,hashes.txt"
# name: "Launcher V3"
# allowUpdates: true
# replacesArtifacts: true
# omitBodyDuringUpdate: true
# removeArtifacts: true
# makeLatest: true
- name: Upload hashes.txt
uses: actions/upload-artifact@v4
with:
name: hashes
path: hashes.txt