Workflow file for this run
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 & Release UnicodeFontSet Module | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '[vV]*' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| env: | |
| FONT_DIR: system/fonts | |
| UPDATE_BIN: META-INF/com/google/android/update-binary | |
| BUILD_DIR: build | |
| jobs: | |
| build: | |
| name: Build ZIP Artifact — ${{ matrix.variant.suffix }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| variant: | |
| - name: "colrv1" | |
| emoji_url: "https://github.com/googlefonts/noto-emoji/raw/main/fonts/Noto-COLRv1.ttf" | |
| zip_name: "UnicodeFontSet-COLRv1-module.zip" | |
| suffix: "COLRv1 (Android 12L+)" | |
| description: "COLRv1 vector emoji" | |
| update_json: "https://github.com/Losketch/UnicodeFontSet-magisk-module/raw/main/update-colrv1.json" | |
| update_json_nightly: "https://github.com/Losketch/UnicodeFontSet-magisk-module/releases/download/nightly/update-nightly-colrv1.json" | |
| - name: "cbdt" | |
| emoji_url: "https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf" | |
| zip_name: "UnicodeFontSet-CBDT-module.zip" | |
| suffix: "CBDT (Android 5.0+)" | |
| description: "CBDT bitmap emoji" | |
| update_json: "https://github.com/Losketch/UnicodeFontSet-magisk-module/raw/main/update-cbdt.json" | |
| update_json_nightly: "https://github.com/Losketch/UnicodeFontSet-magisk-module/releases/download/nightly/update-nightly-cbdt.json" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Create directories | |
| run: | | |
| mkdir -p ${{ env.FONT_DIR }} ${{ env.BUILD_DIR }} $(dirname ${{ env.UPDATE_BIN }}) | |
| - name: Download fonts & scripts | |
| run: | | |
| declare -A files=( | |
| [NotoColorEmoji.ttf]=${{ matrix.variant.emoji_url }} | |
| [SourceHanSansSC-Regular.otf]=https://github.com/adobe-fonts/source-han-sans/raw/release/OTF/SimplifiedChinese/SourceHanSansSC-Regular.otf | |
| [MonuTemp.ttf]=https://github.com/MY1L/Unicode/releases/download/Temp/MonuTemp-0.920.ttf | |
| [NotoUnicode.otf]=https://github.com/MY1L/Unicode/releases/download/NotoUni7/NotoUnicode-7.3.otf | |
| [NewGardiner.ttf]=https://github.com/Mercury13/unicodia/raw/main/Fonts/NewGardiner.ttf | |
| [UnicodiaSesh.ttf]=https://github.com/Mercury13/unicodia/raw/main/Fonts/UnicodiaSesh.ttf | |
| [PlangothicP1-Regular.otf]=https://github.com/Fitzgerald-Porthmouth-Koenigsegg/Plangothic_Project/raw/build/fonts/otf/PlangothicP1-Regular.otf | |
| [PlangothicP2-Regular.otf]=https://github.com/Fitzgerald-Porthmouth-Koenigsegg/Plangothic_Project/raw/build/fonts/otf/PlangothicP2-Regular.otf | |
| [KreativeSquare.ttf]=https://github.com/kreativekorp/open-relay/raw/master/KreativeSquare/KreativeSquare.ttf | |
| [LastResort-Regular.ttf]=https://github.com/unicode-org/last-resort-font/releases/latest/download/LastResort-Regular.ttf | |
| ) | |
| for name in "${!files[@]}"; do | |
| wget --tries=5 -q "${files[$name]}" -O "${{ env.FONT_DIR }}/$name" | |
| done | |
| wget --tries=5 -q https://github.com/topjohnwu/Magisk/raw/master/scripts/module_installer.sh \ | |
| -O "${{ env.UPDATE_BIN }}" | |
| - name: Update module.prop for variant | |
| run: | | |
| sed -i "s|updateJson=.*|updateJson=${{ matrix.variant.update_json }}|" module.prop | |
| - name: Update versionCode for Nightly Builds | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| VERSION_DATE=$(date +%Y%m%d) | |
| sed -i "s/^versionCode=.*/versionCode=${VERSION_DATE}/" module.prop | |
| sed -i "/^version=/ s/$/ (${GITHUB_SHA:0:7}-Nightly-${{ matrix.variant.suffix }})/" module.prop | |
| sed -i "s|updateJson=.*|updateJson=${{ matrix.variant.update_json_nightly }}|" module.prop | |
| - name: Update version for Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| sed -i "/^version=/ s/$/ (${{ matrix.variant.suffix }})/" module.prop | |
| - name: Package ZIP & compute checksum | |
| run: | | |
| zip -9 \ | |
| -x "*.git*" \ | |
| -x "extra/*" \ | |
| -x "${{ env.BUILD_DIR }}/*" \ | |
| -x "documentation/*" \ | |
| -x "sources/*" \ | |
| -r ../${{ matrix.variant.zip_name }} ./ | |
| - name: Collect artifacts | |
| run: | | |
| mv ../${{ matrix.variant.zip_name }} ${{ env.BUILD_DIR }}/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: module-artifacts-${{ matrix.variant.name }} | |
| path: ${{ env.BUILD_DIR }} | |
| release: | |
| name: 正式 Release | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download COLRv1 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: module-artifacts-colrv1 | |
| path: ./artifacts | |
| - name: Download CBDT artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: module-artifacts-cbdt | |
| path: ./artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| files: | | |
| ./artifacts/*.zip | |
| draft: false | |
| prerelease: false | |
| nightly: | |
| name: Nightly Release | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download COLRv1 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: module-artifacts-colrv1 | |
| path: ./artifacts | |
| - name: Download CBDT artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: module-artifacts-cbdt | |
| path: ./artifacts | |
| - name: Get commits since last nightly | |
| id: commits | |
| run: | | |
| LAST_NIGHTLY=$(git tag -l "nightly" | head -n1) | |
| if [ -n "$LAST_NIGHTLY" ]; then | |
| LAST_COMMIT=$(git rev-list -n 1 $LAST_NIGHTLY 2>/dev/null || echo "") | |
| fi | |
| if [ -z "$LAST_COMMIT" ]; then | |
| COMMITS=$(git log --oneline -5 --pretty=format:"- %h: %s (%an)") | |
| else | |
| COMMITS=$(git log --oneline ${LAST_COMMIT}..HEAD --pretty=format:"- %h: %s (%an)") | |
| fi | |
| echo "COMMITS<<EOF" >> $GITHUB_OUTPUT | |
| echo "$COMMITS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Generate nightly update.json files | |
| run: | | |
| VERSION_DATE=$(date +%Y%m%d) | |
| NIGHTLY_VERSION="V17.0.0 (${GITHUB_SHA:0:7}-Nightly)" | |
| RECENT_COMMITS=$(git log --oneline -5 --pretty=format:"- %h: %s (%an)") | |
| cat > changelog.md << EOF | |
| # Nightly Build Changelog | |
| ## Recent Changes (Last 5 commits) | |
| ${RECENT_COMMITS} | |
| Built from commit: ${{ github.sha }} | |
| EOF | |
| cat > update-nightly-colrv1.json << EOF | |
| { | |
| "version": "${NIGHTLY_VERSION} (COLRv1)", | |
| "versionCode": ${VERSION_DATE}, | |
| "zipUrl": "https://github.com/Losketch/UnicodeFontSet-magisk-module/releases/download/nightly/UnicodeFontSet-COLRv1-module.zip", | |
| "changelog": "https://github.com/Losketch/UnicodeFontSet-magisk-module/releases/download/nightly/changelog.md" | |
| } | |
| EOF | |
| cat > update-nightly-cbdt.json << EOF | |
| { | |
| "version": "${NIGHTLY_VERSION} (CBDT)", | |
| "versionCode": ${VERSION_DATE}, | |
| "zipUrl": "https://github.com/Losketch/UnicodeFontSet-magisk-module/releases/download/nightly/UnicodeFontSet-CBDT-module.zip", | |
| "changelog": "https://github.com/Losketch/UnicodeFontSet-magisk-module/releases/download/nightly/changelog.md" | |
| } | |
| EOF | |
| - name: Delete existing nightly release | |
| run: | | |
| set -x | |
| gh release delete nightly --yes -R ${{ github.repository }} || true | |
| git push --delete origin nightly || true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate timestamp | |
| id: timestamp | |
| run: echo "timestamp=$(date +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_OUTPUT | |
| - name: Create Nightly Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: nightly | |
| name: Nightly Build ${{ steps.timestamp.outputs.timestamp }} | |
| body: | | |
| ## Variants | |
| - **COLRv1**: Uses the new COLRv1 format emoji font (Android 12L+) | |
| - **CBDT**: Uses the traditional NotoColorEmoji.ttf (Android 5.0+) | |
| ## Commits | |
| ${{ steps.commits.outputs.COMMITS }} | |
| files: | | |
| ./artifacts/*.zip | |
| update-nightly-colrv1.json | |
| update-nightly-cbdt.json | |
| changelog.md | |
| prerelease: true | |
| make_latest: false |