forked from ESK-Project/esk_builder
-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (153 loc) · 5.26 KB
/
release.yml
File metadata and controls
184 lines (153 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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