Sync glint #159
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: Sync glint | |
| # Keeps the in-tree glint/ encoder copy current with | |
| # github.com/CrispStrobe/glint so releases always ship the latest | |
| # committed glint. Triggered by: | |
| # - repository_dispatch "glint-push" (sent by glint's notify-crispasr | |
| # workflow on every push to its main — needs a CRISPASR_SYNC_PAT | |
| # secret over there) | |
| # - a daily schedule (fallback when the dispatch secret is absent) | |
| # - manual workflow_dispatch | |
| # | |
| # A sync commit is only pushed after the MP3/AAC provenance unit tests | |
| # pass against the new sources. Note: pushes made with the default | |
| # GITHUB_TOKEN do not trigger the full CI workflow — set a GLINT_SYNC_PAT | |
| # secret in this repo if you want sync commits to run CI too. | |
| on: | |
| repository_dispatch: | |
| types: [glint-push] | |
| schedule: | |
| - cron: '17 4 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| ref: main | |
| token: ${{ secrets.GLINT_SYNC_PAT || github.token }} | |
| - name: Sync glint/ from upstream committed state | |
| run: ./tools/sync-glint.sh | |
| - name: Detect changes | |
| id: diff | |
| run: | | |
| if git status --porcelain glint/ | grep -q .; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "glint/ already up to date" | |
| fi | |
| - name: Install dependencies | |
| if: steps.diff.outputs.changed == 'true' | |
| run: sudo apt-get update && sudo apt-get install -y cmake g++ | |
| - name: Build + run MP3/AAC provenance tests | |
| if: steps.diff.outputs.changed == 'true' | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF | |
| cmake --build build --target test_tts_provenance -j $(nproc) | |
| ./build/bin/test_tts_provenance "[mp3],[aac]" | |
| - name: Commit and push | |
| if: steps.diff.outputs.changed == 'true' | |
| run: | | |
| sha="$(sed -n 's/.*Synced at upstream commit: `\([0-9a-f]*\)`.*/\1/p' glint/README.md)" | |
| subject="$(sed -n 's/.*Synced at upstream commit: `[0-9a-f]*` (\(.*\))\..*/\1/p' glint/README.md)" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add glint/ | |
| git commit -m "chore(glint): sync to upstream ${sha:0:12} — ${subject}" | |
| # another push may have landed while tests ran. --autostash: the | |
| # provenance build above dirties tracked files outside glint/ (not | |
| # staged, so never pushed); without it the rebase aborts with | |
| # "cannot pull with rebase: You have unstaged changes". | |
| git pull --rebase --autostash origin main | |
| git push origin main |