Enable full auto versioning (auto bump + auto tag + auto release) #56
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 | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| MODULE_ID: ColorOS-Themes-Rock | ||
| jobs: | ||
| build: | ||
| name: Auto Version + Build + Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Install zip | ||
| run: sudo apt-get update && sudo apt-get install -y zip | ||
| - 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) | ||
| if [ -z "$LATEST" ]; then | ||
| LATEST="v0.0.0" | ||
| fi | ||
| echo "latest=$LATEST" >> $GITHUB_OUTPUT | ||
| - name: Compute next version | ||
| id: version | ||
| run: | | ||
| LATEST=${{ steps.tag.outputs.latest }} | ||
| VERSION_NUM=${LATEST#v} | ||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NUM" | ||
| PATCH=$((PATCH+1)) | ||
| NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" | ||
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| echo "MODULE_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
| - name: Create Git tag | ||
| run: | | ||
| git config user.name "github-actions" | ||
| git config user.email "github-actions@github.com" | ||
| git tag $MODULE_VERSION | ||
| git push origin $MODULE_VERSION | ||
| - name: Validate module | ||
| run: bash scripts/validate-module.sh | ||
| - name: Check theme assets | ||
| run: bash scripts/check-theme-size.sh | ||
| - name: Package module | ||
| run: bash scripts/package.sh | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ColorOS-Themes-Rock-${{ env.MODULE_VERSION }} | ||
| path: dist/*.zip | ||
| - name: Generate release notes | ||
| run: | | ||
| cat > RELEASE_NOTES.md <<EOF | ||
| # ColorOS Themes Rock ${MODULE_VERSION} | ||
| Automated release. | ||
| ## Included | ||
| - Flashable module ZIP | ||
| - OPPO / OnePlus / realme support | ||
| - Theme assets structure | ||
| - CI automated build | ||
| ## Install | ||
| Flash via Magisk / KernelSU / APatch | ||
| EOF | ||
| - name: Publish GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ env.MODULE_VERSION }} | ||
| name: ColorOS Themes Rock ${{ env.MODULE_VERSION }} | ||
| body_path: RELEASE_NOTES.md | ||
| files: dist/*.zip | ||
| draft: false | ||
| prerelease: false | ||