Skip to content

Commit b2e5837

Browse files
ci: update workflows
1 parent 199a30b commit b2e5837

File tree

5 files changed

+64
-140
lines changed

5 files changed

+64
-140
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,47 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [master]
6+
paths:
7+
- grammar.js
8+
- src/**
9+
- test/**
10+
- bindings/**
11+
- examples/**
12+
- tree-sitter.json
713
pull_request:
8-
branches:
9-
- "**"
14+
paths:
15+
- grammar.js
16+
- src/**
17+
- test/**
18+
- bindings/**
19+
- examples/**
20+
- tree-sitter.json
21+
22+
concurrency:
23+
group: ${{github.workflow}}-${{github.ref}}
24+
cancel-in-progress: true
1025

1126
jobs:
1227
test:
13-
runs-on: ${{ matrix.os }}
28+
name: Test parser
29+
runs-on: ${{matrix.os}}
1430
strategy:
15-
fail-fast: true
31+
fail-fast: false
1632
matrix:
17-
os: [macos-latest, ubuntu-latest]
33+
os: [ubuntu-latest, windows-latest, macos-latest]
1834
steps:
19-
- uses: actions/checkout@v3
20-
- uses: actions/setup-node@v2
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
- name: Set up tree-sitter
38+
uses: tree-sitter/setup-action/cli@v2
39+
- name: Run parser and binding tests
40+
uses: tree-sitter/parser-test-action@v2
2141
with:
22-
node-version: 16
23-
- run: npm install
24-
- run: npm test
25-
26-
test_windows:
27-
runs-on: windows-2019
28-
steps:
29-
- uses: actions/checkout@v3
30-
- uses: actions/setup-node@v2
42+
generate: false
43+
test-rust: true
44+
- name: Parse sample files
45+
uses: tree-sitter/parse-action@v4
46+
id: parse-files
3147
with:
32-
node-version: 16
33-
- run: npm install
34-
- run: npm run-script test-windows
48+
files: examples/**

.github/workflows/lint.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@ name: Lint
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [master]
6+
paths:
7+
- grammar.js
78
pull_request:
8-
branches:
9-
- "**"
9+
paths:
10+
- grammar.js
1011

1112
jobs:
1213
lint:
1314
runs-on: ubuntu-latest
1415
steps:
15-
- uses: actions/checkout@v3
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
cache: npm
22+
node-version: ${{vars.NODE_VERSION}}
1623
- name: Install modules
17-
run: npm install
24+
run: npm ci --legacy-peer-deps
1825
- name: Run ESLint
1926
run: npm run lint

.github/workflows/publish.yml

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,15 @@
11
name: Publish
22

33
on:
4-
pull_request:
5-
types: [closed]
6-
7-
permissions:
8-
contents: write
4+
push:
5+
tags: ["*"]
96

107
jobs:
11-
build:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-node@v3
16-
with:
17-
node-version: 16
18-
- run: npm install
19-
- run: npm test
20-
21-
publish:
22-
if: github.event.pull_request.merged && startsWith(github.event.pull_request.title, 'chore(master):')
23-
needs: build
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v3
27-
with:
28-
ref: ${{ github.event.pull_request.merge_commit_sha }}
29-
token: ${{ secrets.GITHUB_TOKEN }}
30-
- name: Extract version
31-
id: extract_version
32-
run: |
33-
PR_TITLE="${{ github.event.pull_request.title }}"
34-
VERSION=$(echo "$PR_TITLE" | grep -oP '(?<=release ).*$')
35-
echo "::set-output name=version::$VERSION"
36-
- name: Update versions
37-
run: |
38-
version="${{ steps.extract_version.outputs.version }}"
39-
repo_name="${{ github.repository }}"
40-
repo_name="${repo_name##*/}"
41-
42-
git config user.name github-actions[bot]
43-
git config user.email github-actions[bot]@users.noreply.github.com
44-
git fetch origin master
45-
git checkout master
46-
47-
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/g" package.json
48-
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml
49-
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md
50-
51-
git add package.json Cargo.toml bindings/rust/README.md
52-
git commit -m "chore(manifests): bump version to $version"
53-
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:master
54-
- name: Setup Node.js
55-
uses: actions/setup-node@v3
56-
with:
57-
node-version: 16
58-
registry-url: https://registry.npmjs.org/
59-
- run: npm publish
60-
env:
61-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
62-
- name: Setup Rust
63-
uses: actions-rs/toolchain@v1
64-
with:
65-
profile: minimal
66-
toolchain: stable
67-
override: true
68-
- name: Publish to Crates.io
69-
uses: katyo/publish-crates@v2
70-
with:
71-
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
72-
- uses: actions/checkout@v3
73-
- name: Tag stable versions
74-
run: |
75-
git config user.name github-actions[bot]
76-
git config user.email github-actions[bot]@users.noreply.github.com
77-
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
78-
git tag -d stable || true
79-
git push origin :stable || true
80-
git tag -a stable -m "Last Stable Release"
81-
git push origin stable
8+
npm:
9+
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
10+
secrets:
11+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
12+
crates:
13+
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
14+
secrets:
15+
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}

.github/workflows/release.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,15 @@ name: Release
22

33
on:
44
push:
5-
branches:
6-
- master
7-
workflow_dispatch:
5+
tags: ["*"]
86

97
permissions:
108
contents: write
11-
pull-requests: write
9+
id-token: write
10+
attestations: write
1211

1312
jobs:
14-
build:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-node@v3
19-
with:
20-
node-version: 16
21-
- run: npm install
22-
- run: npm test
23-
2413
release:
25-
name: release
26-
if: ${{ github.ref == 'refs/heads/master' }}
27-
needs:
28-
- build
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: google-github-actions/release-please-action@v3
32-
id: release
33-
with:
34-
release-type: simple
35-
package-name: tree-sitter-go-sum
14+
uses: tree-sitter/workflows/.github/workflows/release.yml@main
15+
with:
16+
attestations: true

CHANGELOG.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)