|
| 1 | +name: Pre-Release On-Demand |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: 'Branch to build from' |
| 8 | + type: string |
| 9 | + required: false |
| 10 | + default: dev |
| 11 | + custom_version: |
| 12 | + 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>.' |
| 13 | + type: string |
| 14 | + required: false |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-linux: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + env: |
| 20 | + BUILD_TYPE: pre-release |
| 21 | + CUSTOM_VERSION: ${{ inputs.custom_version }} |
| 22 | + outputs: |
| 23 | + tag: ${{ steps.version.outputs.tag }} |
| 24 | + version: ${{ steps.version.outputs.version }} |
| 25 | + full_version: ${{ steps.version.outputs.full_version }} |
| 26 | + steps: |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + ref: ${{ inputs.branch }} |
| 31 | + fetch-depth: 0 |
| 32 | + submodules: recursive |
| 33 | + |
| 34 | + - name: Extract Version |
| 35 | + id: version |
| 36 | + run: | |
| 37 | + VERSION=$(grep '#define WKAL_VERSION' include/wkali.h | awk '{print $3}' | tr -d '"' | tr -d '\r') |
| 38 | + if [ -z "$VERSION" ]; then |
| 39 | + echo "Error: Could not find WKAL_VERSION in include/wkali.h" |
| 40 | + exit 1 |
| 41 | + fi |
| 42 | + echo "Extracted base version: $VERSION" |
| 43 | + FULL=$(python3 tools/gen_version.py --print) |
| 44 | + echo "Full version: $FULL" |
| 45 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 46 | + echo "full_version=${FULL}" >> $GITHUB_OUTPUT |
| 47 | + echo "tag=v${FULL}" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | + - name: Check if release exists |
| 50 | + env: |
| 51 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + run: | |
| 53 | + TAG="${{ steps.version.outputs.tag }}" |
| 54 | + if gh release view "$TAG" >/dev/null 2>&1; then |
| 55 | + echo "Release $TAG already exists. Aborting." |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | + echo "Release $TAG does not exist. Proceeding." |
| 59 | +
|
| 60 | + - name: Build WebKit Autoloader Installer & Host Script |
| 61 | + run: | |
| 62 | + chmod +x build_release.sh |
| 63 | + ./build_release.sh |
| 64 | +
|
| 65 | + - name: Upload ELF, Script and Icon Artifacts |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: linux-build |
| 69 | + path: | |
| 70 | + webkit-autoloader-installer_v*.elf |
| 71 | + webkit-autoloader-host_v*.py |
| 72 | + assets/icon.ico |
| 73 | + retention-days: 1 |
| 74 | + |
| 75 | + build-windows: |
| 76 | + needs: build-linux |
| 77 | + runs-on: windows-latest |
| 78 | + steps: |
| 79 | + - name: Setup Python |
| 80 | + uses: actions/setup-python@v5 |
| 81 | + with: |
| 82 | + python-version: '3.11' |
| 83 | + |
| 84 | + - name: Install PyInstaller |
| 85 | + run: pip install pyinstaller |
| 86 | + |
| 87 | + - name: Download Linux Artifacts |
| 88 | + uses: actions/download-artifact@v4 |
| 89 | + with: |
| 90 | + name: linux-build |
| 91 | + path: . |
| 92 | + |
| 93 | + - name: Build Windows Executable |
| 94 | + 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" |
| 95 | + |
| 96 | + - name: Upload Windows Executable Artifact |
| 97 | + uses: actions/upload-artifact@v4 |
| 98 | + with: |
| 99 | + name: windows-build |
| 100 | + path: dist/webkit-autoloader-host_v*.exe |
| 101 | + retention-days: 1 |
| 102 | + |
| 103 | + create-release: |
| 104 | + needs: [build-linux, build-windows] |
| 105 | + runs-on: ubuntu-latest |
| 106 | + permissions: |
| 107 | + contents: write |
| 108 | + steps: |
| 109 | + - name: Checkout repository (for git history) |
| 110 | + uses: actions/checkout@v4 |
| 111 | + with: |
| 112 | + ref: ${{ inputs.branch }} |
| 113 | + fetch-depth: 0 |
| 114 | + |
| 115 | + - name: Download Linux Artifacts |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + name: linux-build |
| 119 | + path: . |
| 120 | + |
| 121 | + - name: Download Windows Artifacts |
| 122 | + uses: actions/download-artifact@v4 |
| 123 | + with: |
| 124 | + name: windows-build |
| 125 | + path: . |
| 126 | + |
| 127 | + - name: Create Pre-Release |
| 128 | + env: |
| 129 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 130 | + run: | |
| 131 | + set -euo pipefail |
| 132 | + TAG="${{ needs.build-linux.outputs.tag }}" |
| 133 | + FULL="${{ needs.build-linux.outputs.full_version }}" |
| 134 | + REPO="${{ github.repository }}" |
| 135 | +
|
| 136 | + ELF="webkit-autoloader-installer_v${FULL}.elf" |
| 137 | + PY="webkit-autoloader-host_v${FULL}.py" |
| 138 | + EXE="webkit-autoloader-host_v${FULL}.exe" |
| 139 | + EXE_BASE="$(basename "${EXE}")" |
| 140 | +
|
| 141 | + PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") |
| 142 | + if [ -n "$PREV_TAG" ]; then |
| 143 | + CHANGELOG="**Full Changelog** (since [${PREV_TAG}](https://github.com/${REPO}/releases/tag/${PREV_TAG})): https://github.com/${REPO}/compare/${PREV_TAG}...${TAG}" |
| 144 | + else |
| 145 | + CHANGELOG="First Release." |
| 146 | + fi |
| 147 | +
|
| 148 | + cat > release_body.md <<EOF |
| 149 | + > [!WARNING] |
| 150 | + > This is a **pre-release / test build** from branch \`${{ inputs.branch }}\`. It is not intended for end users — expect bugs and changes. |
| 151 | +
|
| 152 | + ## Downloads |
| 153 | +
|
| 154 | + | Platform | File | |
| 155 | + |---|---| |
| 156 | + | **PS5** (installer payload) | [${ELF}](https://github.com/${REPO}/releases/download/${TAG}/${ELF}) | |
| 157 | + | **Linux / macOS / WSL** (installer-host) | [${PY}](https://github.com/${REPO}/releases/download/${TAG}/${PY}) | |
| 158 | + | **Windows** (installer-host) | [${EXE_BASE}](https://github.com/${REPO}/releases/download/${TAG}/${EXE_BASE}) | |
| 159 | +
|
| 160 | + --- |
| 161 | +
|
| 162 | + ${CHANGELOG} |
| 163 | + EOF |
| 164 | +
|
| 165 | + gh release create "$TAG" \ |
| 166 | + --prerelease \ |
| 167 | + --title "$TAG (pre-release)" \ |
| 168 | + --notes-file release_body.md \ |
| 169 | + "$ELF" "$PY" "$EXE" |
0 commit comments