Update from monorepo #7226
This file contains 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: Update from monorepo | |
on: | |
schedule: | |
- cron: "29 * * * *" | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- mono_repo_ref: release/1 | |
this_ref: master | |
- mono_repo_ref: master | |
this_ref: nightly | |
steps: | |
- name: Check out monorepo | |
uses: actions/checkout@v4 | |
with: | |
repository: slint-ui/slint | |
ref: ${{ matrix.mono_repo_ref}} | |
sparse-checkout: editors/tree-sitter-slint | |
path: monorepo | |
- name: Check out tree-sitter-slint repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.this_ref}} | |
path: mine | |
- uses: robinraju/[email protected] | |
with: | |
repository: "tree-sitter/tree-sitter" | |
latest: true | |
fileName: "tree-sitter-linux-x64.gz" | |
out-file-path: ${{ runner.workspace }} | |
- name: Extract tree-sitter-cli | |
run: | | |
gunzip tree-sitter-linux-x64.gz | |
chmod 755 tree-sitter-linux-x64 | |
mv tree-sitter-linux-x64 tree-sitter | |
working-directory: ${{ runner.workspace }} | |
- name: Update grammar.js | |
run: | | |
cp monorepo/editors/tree-sitter-slint/grammar.js mine | |
( cd mine && "${{ runner.workspace }}/tree-sitter" generate ) | |
# TODO: Remove after 1.7 | |
- name: Relicense master branch | |
if: ${{ matrix.this_ref == 'master' }} | |
run: | | |
sed -ie "s!^// SPDX-License-Identifier: .*\$!// SPDX-License-Identifier: MIT!" grammar.js | |
working-directory: mine | |
- name: Git status | |
run: | | |
git status | |
git diff | |
working-directory: mine | |
- name: Push to repository | |
run: | | |
TS_VERSION=$( "${{ runner.workspace }}/tree-sitter" --version ) | |
MONOREPO_VERSION=$( cd ../monorepo ; git log -n 1 --pretty=format:%H -- editors/tree-sitter-slint/grammar.js ) | |
git config --global user.name "slint tree-sitter bot" | |
git config --global user.email "[email protected]" | |
git add -A && git commit -m "Update: grammar ${MONOREPO_VERSION} using ${TS_VERSION}" && git push || true | |
working-directory: mine |