Pre-Release On-Demand #6
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: Pre-Release On-Demand | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to build from' | |
| type: string | |
| required: false | |
| default: dev | |
| custom_version: | |
| description: 'Optional version suffix appended to the base version (e.g. umtx2-test -> 0.2.2-umtx2-test). Leave empty for auto 0.2.2-pre-<githash>.' | |
| type: string | |
| required: false | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| env: | |
| BUILD_TYPE: pre-release | |
| CUSTOM_VERSION: ${{ inputs.custom_version }} | |
| outputs: | |
| tag: ${{ steps.version.outputs.tag }} | |
| version: ${{ steps.version.outputs.version }} | |
| full_version: ${{ steps.version.outputs.full_version }} | |
| sha: ${{ steps.version.outputs.sha }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch }} | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Extract Version | |
| id: version | |
| run: | | |
| VERSION=$(grep '#define WKAL_VERSION' include/wkali.h | awk '{print $3}' | tr -d '"' | tr -d '\r') | |
| if [ -z "$VERSION" ]; then | |
| echo "Error: Could not find WKAL_VERSION in include/wkali.h" | |
| exit 1 | |
| fi | |
| echo "Extracted base version: $VERSION" | |
| FULL=$(python3 tools/gen_version.py --print) | |
| echo "Full version: $FULL" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "full_version=${FULL}" >> $GITHUB_OUTPUT | |
| echo "tag=v${FULL}" >> $GITHUB_OUTPUT | |
| echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Check if release exists | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${{ steps.version.outputs.tag }}" | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| echo "Release $TAG already exists. Aborting." | |
| exit 1 | |
| fi | |
| echo "Release $TAG does not exist. Proceeding." | |
| - name: Build WebKit Autoloader Installer & Host Script | |
| run: | | |
| chmod +x build_release.sh | |
| ./build_release.sh | |
| - name: Upload ELF, Script and Icon Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: | | |
| webkit-autoloader-installer_v*.elf | |
| webkit-autoloader-host_v*.py | |
| assets/icon.ico | |
| retention-days: 1 | |
| build-windows: | |
| needs: build-linux | |
| runs-on: windows-latest | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install PyInstaller | |
| run: pip install pyinstaller | |
| - name: Download Linux Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: . | |
| - name: Build Windows Executable | |
| run: pyinstaller --onefile --noconfirm --icon assets/icon.ico --name webkit-autoloader-host_v${{ needs.build-linux.outputs.full_version }} "webkit-autoloader-host_v${{ needs.build-linux.outputs.full_version }}.py" | |
| - name: Upload Windows Executable Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: dist/webkit-autoloader-host_v*.exe | |
| retention-days: 1 | |
| create-release: | |
| needs: [build-linux, build-windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository (for git history) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.branch }} | |
| fetch-depth: 0 | |
| - name: Download Linux Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: . | |
| - name: Download Windows Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: . | |
| - name: Create Pre-Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| TAG="${{ needs.build-linux.outputs.tag }}" | |
| FULL="${{ needs.build-linux.outputs.full_version }}" | |
| SHA="${{ needs.build-linux.outputs.sha }}" | |
| REPO="${{ github.repository }}" | |
| ELF="webkit-autoloader-installer_v${FULL}.elf" | |
| PY="webkit-autoloader-host_v${FULL}.py" | |
| EXE="webkit-autoloader-host_v${FULL}.exe" | |
| EXE_BASE="$(basename "${EXE}")" | |
| PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -n "$PREV_TAG" ]; then | |
| CHANGELOG="**Full Changelog** (since [${PREV_TAG}](https://github.com/${REPO}/releases/tag/${PREV_TAG})): https://github.com/${REPO}/compare/${PREV_TAG}...${TAG}" | |
| else | |
| CHANGELOG="First Release." | |
| fi | |
| cat > release_body.md <<EOF | |
| > [!WARNING] | |
| > This is a **pre-release / test build** from branch \`${{ inputs.branch }}\`. It is not intended for end users — expect bugs and changes. | |
| ## Downloads | |
| | Platform | File | | |
| |---|---| | |
| | **PS5** (installer payload) | [${ELF}](https://github.com/${REPO}/releases/download/${TAG}/${ELF}) | | |
| | **Linux / macOS / WSL** (installer-host) | [${PY}](https://github.com/${REPO}/releases/download/${TAG}/${PY}) | | |
| | **Windows** (installer-host) | [${EXE_BASE}](https://github.com/${REPO}/releases/download/${TAG}/${EXE_BASE}) | | |
| --- | |
| ${CHANGELOG} | |
| EOF | |
| gh release create "$TAG" \ | |
| --prerelease \ | |
| --target "$SHA" \ | |
| --title "$TAG (pre-release)" \ | |
| --notes-file release_body.md \ | |
| "$ELF" "$PY" "$EXE" |