-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (168 loc) · 5.08 KB
/
Copy pathbuild-theme-module.yml
File metadata and controls
186 lines (168 loc) · 5.08 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
185
186
name: Build Theme Module
on:
pull_request:
branches:
- main
paths:
- 'module.prop'
- 'customize.sh'
- 'post-fs-data.sh'
- 'service.sh'
- 'uninstall.sh'
- 'scripts/**'
- 'themes/**'
- 'theme-packs/**'
- 'customer-options/**'
- 'assets/**'
- 'docs/**'
- 'lsposed-helper/**'
- 'latestStable.json'
- 'latestBeta.json'
- 'latestNightly.json'
- '.github/workflows/build-theme-module.yml'
push:
branches:
- main
tags:
- 'v*'
paths:
- 'module.prop'
- 'customize.sh'
- 'post-fs-data.sh'
- 'service.sh'
- 'uninstall.sh'
- 'scripts/**'
- 'themes/**'
- 'theme-packs/**'
- 'customer-options/**'
- 'assets/**'
- 'docs/**'
- 'lsposed-helper/**'
- 'latestStable.json'
- 'latestBeta.json'
- 'latestNightly.json'
- '.github/workflows/build-theme-module.yml'
workflow_dispatch:
inputs:
version:
description: 'Module version, example: v0.6.0'
required: false
default: ''
publish:
description: 'Publish GitHub Release'
required: true
type: boolean
default: true
concurrency:
group: build-theme-module-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
id-token: write
attestations: write
env:
MODULE_ID: ColorOS-Themes-Rock
jobs:
validate:
name: Validate Module
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Validate module structure
run: bash scripts/validate-module.sh
- name: Inspect known theme packages
run: |
find theme-packs -type f -name '*.theme' -print0 | while IFS= read -r -d '' file; do
python3 scripts/inspect-theme-package.py "$file" --pretty
done
build:
name: Build Module ZIP
needs: validate
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
version: ${{ steps.meta.outputs.version }}
artifact_name: ${{ steps.meta.outputs.artifact_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install zip
run: sudo apt-get update && sudo apt-get install -y zip coreutils
- name: Resolve version
id: meta
shell: bash
run: |
VERSION="${{ inputs.version }}"
if [[ -z "$VERSION" && "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="$GITHUB_REF_NAME"
fi
if [[ -z "$VERSION" ]]; then
VERSION="$(grep -E '^version=' module.prop | head -n 1 | cut -d'=' -f2-)"
fi
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-beta)?$ ]]; then
echo "Invalid version format: $VERSION"
exit 1
fi
echo "MODULE_VERSION=$VERSION" >> "$GITHUB_ENV"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "artifact_name=${MODULE_ID}-${VERSION}" >> "$GITHUB_OUTPUT"
- name: Build module
run: bash scripts/package.sh
- name: Collect files
run: |
mkdir -p release/module
cp dist/*.zip release/module/
cat > release/module/BUILD_INFO.txt <<INFO
Project: ${MODULE_ID}
Version: ${MODULE_VERSION}
Commit: ${GITHUB_SHA}
Workflow: ${GITHUB_WORKFLOW}
Run ID: ${GITHUB_RUN_ID}
Android target policy: Android 15 supported, Android 16/17 device testing required
INFO
(cd release/module && sha256sum * > SHA256SUMS.txt)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.artifact_name }}
path: release/module/*
if-no-files-found: error
retention-days: 30
- name: Generate build provenance attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: 'release/module/*'
publish:
name: Publish Release
needs: build
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.publish) || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
path: release/module
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.version }}
name: ColorOS Themes Rock ${{ needs.build.outputs.version }}
body: |
ColorOS Themes Rock module build.
Included files:
- Module ZIP
- BUILD_INFO.txt
- SHA256SUMS.txt
files: release/module/*
draft: false
prerelease: ${{ contains(needs.build.outputs.version, 'beta') }}