Skip to content

Commit 7ce6009

Browse files
committed
Upgrade toolkit to PRO release system (channels + checksums + caching)
1 parent e19a1bf commit 7ce6009

1 file changed

Lines changed: 49 additions & 30 deletions

File tree

.github/workflows/build-module.yml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
name: Build Theme Module
1+
name: Build Theme Module PRO
22

33
on:
44
push:
55
branches: [ main ]
66

7+
concurrency:
8+
group: release-${{ github.ref }}
9+
cancel-in-progress: true
10+
711
permissions:
812
contents: write
913

@@ -12,7 +16,7 @@ env:
1216

1317
jobs:
1418
build:
15-
name: Smart Release (SemVer + Changelog)
19+
name: PRO Release System (Stable + Beta + Checksums)
1620
runs-on: ubuntu-latest
1721

1822
steps:
@@ -21,69 +25,84 @@ jobs:
2125
with:
2226
fetch-depth: 0
2327

24-
- name: Install zip
25-
run: sudo apt-get update && sudo apt-get install -y zip
28+
- name: Cache tools
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.cache
32+
key: ${{ runner.os }}-tools
33+
34+
- name: Install dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y zip coreutils
38+
39+
- name: Detect release channel
40+
id: channel
41+
run: |
42+
if echo "${{ github.event.head_commit.message }}" | grep -qi "beta"; then
43+
echo "channel=beta" >> $GITHUB_OUTPUT
44+
else
45+
echo "channel=stable" >> $GITHUB_OUTPUT
46+
fi
2647
2748
- name: Get latest tag
2849
id: tag
2950
run: |
3051
git fetch --tags
3152
LATEST=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n 1 || true)
32-
if [ -z "$LATEST" ]; then
33-
LATEST="v0.0.0"
34-
fi
53+
[ -z "$LATEST" ] && LATEST="v0.0.0"
3554
echo "latest=$LATEST" >> $GITHUB_OUTPUT
3655
37-
- name: Compute next version (SemVer)
56+
- name: Compute version (PRO SemVer)
3857
id: version
3958
run: |
4059
LATEST="${{ steps.tag.outputs.latest }}"
4160
VERSION_NUM=${LATEST#v}
4261
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NUM"
4362
44-
# default patch bump
4563
PATCH=$((PATCH+1))
4664
47-
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
65+
CHANNEL="${{ steps.channel.outputs.channel }}"
66+
67+
if [ "$CHANNEL" = "beta" ]; then
68+
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}-beta"
69+
else
70+
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
71+
fi
4872
4973
echo "MODULE_VERSION=$NEW_VERSION" >> $GITHUB_ENV
50-
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
5174
5275
- name: Generate changelog
5376
run: |
5477
echo "# ColorOS Themes Rock ${MODULE_VERSION}" > RELEASE_NOTES.md
5578
echo "" >> RELEASE_NOTES.md
5679
echo "## Changes" >> RELEASE_NOTES.md
5780
git log $(git describe --tags --abbrev=0 2>/dev/null || echo '')..HEAD --pretty=format:'- %s' >> RELEASE_NOTES.md || true
58-
59-
- name: Create Git tag
60-
run: |
61-
git config user.name "github-actions"
62-
git config user.email "github-actions@github.com"
63-
git tag $MODULE_VERSION
64-
git push origin $MODULE_VERSION
65-
66-
- name: Validate module
67-
run: bash scripts/validate-module.sh
68-
69-
- name: Check theme assets
70-
run: bash scripts/check-theme-size.sh
81+
echo "" >> RELEASE_NOTES.md
82+
echo "## Channel: ${{ steps.channel.outputs.channel }}" >> RELEASE_NOTES.md
7183
7284
- name: Package module
7385
run: bash scripts/package.sh
7486

87+
- name: Generate SHA256 checksum
88+
run: |
89+
cd dist
90+
for f in *.zip; do
91+
sha256sum "$f" > "$f.sha256"
92+
done
93+
7594
- name: Upload artifact
7695
uses: actions/upload-artifact@v4
7796
with:
78-
name: ColorOS-Themes-Rock-${{ env.MODULE_VERSION }}
79-
path: dist/*.zip
97+
name: ColorOS-Themes-Rock-PRO-${{ env.MODULE_VERSION }}
98+
path: dist/*
8099

81-
- name: Publish GitHub Release
100+
- name: Publish GitHub Release (PRO)
82101
uses: softprops/action-gh-release@v2
83102
with:
84103
tag_name: ${{ env.MODULE_VERSION }}
85-
name: ColorOS Themes Rock ${{ env.MODULE_VERSION }}
104+
name: ColorOS Themes Rock PRO ${{ env.MODULE_VERSION }}
86105
body_path: RELEASE_NOTES.md
87-
files: dist/*.zip
106+
files: dist/*
88107
draft: false
89-
prerelease: false
108+
prerelease: ${{ contains(env.MODULE_VERSION, 'beta') }}

0 commit comments

Comments
 (0)