Release Build #64
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: Release Build | |
| permissions: | |
| contents: write | |
| actions: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_target: | |
| description: "Build target" | |
| type: choice | |
| required: true | |
| default: xaga | |
| options: | |
| - xaga | |
| - generic | |
| create_release: | |
| description: "Create release?" | |
| type: boolean | |
| required: true | |
| default: true | |
| jobs: | |
| prepare: | |
| name: Load Matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.matrix.outputs.json }} | |
| steps: | |
| - name: Checkout current repo | |
| uses: actions/checkout@v6.0.1 | |
| with: | |
| fetch-depth: 1 | |
| - name: Read matrix file | |
| id: matrix | |
| env: | |
| build_target: ${{ github.event.inputs.build_target }} | |
| run: | | |
| matrix="$GITHUB_WORKSPACE/.github/matrix/${build_target}.json" | |
| if [[ ! -f "$matrix" ]]; then | |
| echo "::error::Missing matrix file: $matrix" | |
| exit 1 | |
| fi | |
| echo "json=$(jq -c . "$matrix")" >> "$GITHUB_OUTPUT" | |
| build: | |
| needs: prepare | |
| strategy: | |
| matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} | |
| name: Build ${{ matrix.variant.name }} variant | |
| uses: ./.github/workflows/build.yml | |
| secrets: inherit | |
| with: | |
| BUILD_TARGET: ${{ github.event.inputs.build_target }} | |
| KSU: ${{ matrix.variant.KSU }} | |
| SUSFS: ${{ matrix.variant.SUSFS }} | |
| LXC: ${{ matrix.variant.LXC }} | |
| STOCK_CONFIG: auto | |
| TG_NOTIFY: false | |
| release: | |
| name: Create Release | |
| needs: build | |
| if: ${{ github.event.inputs.create_release == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current repo | |
| uses: actions/checkout@v6.0.1 | |
| with: | |
| fetch-depth: 1 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: release_files | |
| - name: Setup Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: "3.14" | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Import build metadata | |
| run: | | |
| metadata_file="release_files/github-metadata-VNL/github.json" | |
| [[ -f "$metadata_file" ]] || { echo "::error::github.json missing"; exit 1; } | |
| python3 - "$metadata_file" "$GITHUB_ENV" <<'PY' | |
| import json | |
| import sys | |
| with open(sys.argv[1]) as f: | |
| data = json.load(f) | |
| keys = ["kernel_name", "kernel_version", "toolchain", "release_repo", "release_branch"] | |
| with open(sys.argv[2], "a") as out: | |
| for key in keys: | |
| out.write(f"{key.upper()}={data[key]}\n") | |
| PY | |
| # Filter metadata from release assets | |
| find release_files -type f -name '*.json' -delete | |
| - name: Generate new tag | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| RELEASE_REPO: ${{ env.RELEASE_REPO }} | |
| run: | | |
| UV_PROJECT="$GITHUB_WORKSPACE/py" | |
| RELEASE_TAG=$(uv run --project "$UV_PROJECT" tools release next-tag "$RELEASE_REPO") | |
| echo "New tag: $RELEASE_TAG" | |
| echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV" | |
| - name: Upload builds to release | |
| uses: softprops/action-gh-release@v2.5.0 | |
| with: | |
| repository: ${{ env.RELEASE_REPO }} | |
| name: "${{ env.KERNEL_NAME }} Kernel ${{ github.event.inputs.build_target }} ${{ env.RELEASE_TAG }}" | |
| tag_name: ${{ env.RELEASE_TAG }} | |
| token: ${{ secrets.GH_TOKEN }} | |
| body: | | |
| ### Key Changes | |
| - Add your key changes here. | |
| --- | |
| ### Build Information | |
| | Field | Value | | |
| |------|-------| | |
| | **Kernel Name** | ${{ env.KERNEL_NAME }} | | |
| | **Kernel Version** | ${{ env.KERNEL_VERSION }} | | |
| | **Compiler** | ${{ env.TOOLCHAIN }} | | |
| ### Variants Suffixes | |
| | Suffix | Description | | |
| |--------|-------------| | |
| | **-VNL** | No KernelSU | | |
| | **-KSU** | KernelSU | | |
| | **-SUSFS** | SUSFS Support | | |
| | **-LXC** | LXC Support for xaga builds | | |
| > [!IMPORTANT] | |
| > For installation instructions and issue reporting guidelines, please refer to the README.md | |
| generate_release_notes: false | |
| prerelease: true | |
| target_commitish: ${{ env.RELEASE_BRANCH }} | |
| files: release_files/**/* | |
| - name: Notify Telegram | |
| env: | |
| TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
| TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }} | |
| run: | | |
| UV_PROJECT="$GITHUB_WORKSPACE/py" | |
| escape_md_v2() { | |
| python3 - "$*" <<'PY' | |
| import sys, re | |
| s = sys.argv[1] | |
| escaped = re.sub(r'([\\_*[\]()~`>#+\-=|{}.!])', r'\\\1', s) | |
| print(escaped, end="") | |
| PY | |
| } | |
| message=$( | |
| cat <<EOF | |
| 📦 *$(escape_md_v2 "$KERNEL_NAME Release Build Completed!")* | |
| *Target:* $(escape_md_v2 "${{ github.event.inputs.build_target }}") | |
| [GitHub Release]($(escape_md_v2 "https://github.com/${{ env.RELEASE_REPO }}/releases/${{ env.RELEASE_TAG }}")) | |
| EOF | |
| ) | |
| printf '%s' "$message" | uv run --project "$UV_PROJECT" tools tg msg |