Upgrade Dependencies #442
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: Upgrade Dependencies | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [tree-sitter-tlaplus-release] | |
jobs: | |
update-ts-tla-wasm: | |
name: Upgrade Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{secrets.GH_PAT}} | |
- name: Setup node.js | |
uses: actions/setup-node@v4 | |
- name: Check for updates | |
run: | | |
npm install web-tree-sitter | |
version=$(npm view web-tree-sitter version) | |
echo "web-tree-sitter version: $version" | |
package_path="./node_modules/web-tree-sitter/tree-sitter.wasm" | |
repo_path="./tree-sitter-tlaplus/js/tree-sitter.wasm" | |
cp "$package_path" "$repo_path" | |
package_path="./node_modules/web-tree-sitter/tree-sitter.js" | |
repo_path="./tree-sitter-tlaplus/js/tree-sitter.js" | |
cp "$package_path" "$repo_path" | |
wget -nv "https://github.com/tlaplus-community/tree-sitter-tlaplus/releases/latest/download/tree-sitter-tlaplus.wasm" \ | |
-O "./tree-sitter-tlaplus/js/tree-sitter-tlaplus.wasm" | |
diff_count=$(git status --porcelain=v1 2>/dev/null | wc -l) | |
echo "Diff count: $diff_count" | |
if [ "$diff_count" -gt 0 ]; then | |
echo "Files differ; update necessary" | |
git config user.name "github-runner" | |
git commit -am "Upgrade tree-sitter-tlaplus WASM and/or web-tree-sitter $version" | |
git push origin | |
else | |
echo "Files are identical. No update necessary." | |
fi | |