Upgrade toolkit to PRO release system (channels + checksums + caching) #58
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: Build Theme Module PRO | |
| on: | |
| push: | |
| branches: [ main ] | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| env: | |
| MODULE_ID: ColorOS-Themes-Rock | |
| jobs: | |
| build: | |
| name: PRO Release System (Stable + Beta + Checksums) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache tools | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache | |
| key: ${{ runner.os }}-tools | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y zip coreutils | |
| - name: Detect release channel | |
| id: channel | |
| run: | | |
| if echo "${{ github.event.head_commit.message }}" | grep -qi "beta"; then | |
| echo "channel=beta" >> $GITHUB_OUTPUT | |
| else | |
| echo "channel=stable" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get latest tag | |
| id: tag | |
| run: | | |
| git fetch --tags | |
| LATEST=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n 1 || true) | |
| [ -z "$LATEST" ] && LATEST="v0.0.0" | |
| echo "latest=$LATEST" >> $GITHUB_OUTPUT | |
| - name: Compute version (PRO SemVer) | |
| id: version | |
| run: | | |
| LATEST="${{ steps.tag.outputs.latest }}" | |
| VERSION_NUM=${LATEST#v} | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NUM" | |
| PATCH=$((PATCH+1)) | |
| CHANNEL="${{ steps.channel.outputs.channel }}" | |
| if [ "$CHANNEL" = "beta" ]; then | |
| NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}-beta" | |
| else | |
| NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |
| fi | |
| echo "MODULE_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| - name: Generate changelog | |
| run: | | |
| echo "# ColorOS Themes Rock ${MODULE_VERSION}" > RELEASE_NOTES.md | |
| echo "" >> RELEASE_NOTES.md | |
| echo "## Changes" >> RELEASE_NOTES.md | |
| git log $(git describe --tags --abbrev=0 2>/dev/null || echo '')..HEAD --pretty=format:'- %s' >> RELEASE_NOTES.md || true | |
| echo "" >> RELEASE_NOTES.md | |
| echo "## Channel: ${{ steps.channel.outputs.channel }}" >> RELEASE_NOTES.md | |
| - name: Package module | |
| run: bash scripts/package.sh | |
| - name: Generate SHA256 checksum | |
| run: | | |
| cd dist | |
| for f in *.zip; do | |
| sha256sum "$f" > "$f.sha256" | |
| done | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ColorOS-Themes-Rock-PRO-${{ env.MODULE_VERSION }} | |
| path: dist/* | |
| - name: Publish GitHub Release (PRO) | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.MODULE_VERSION }} | |
| name: ColorOS Themes Rock PRO ${{ env.MODULE_VERSION }} | |
| body_path: RELEASE_NOTES.md | |
| files: dist/* | |
| draft: false | |
| prerelease: ${{ contains(env.MODULE_VERSION, 'beta') }} |