-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.52 KB
/
Copy pathsync.yml
File metadata and controls
78 lines (67 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Sync from ClickHouse
# Daily: copy the latest lexer sources from the main ClickHouse repository. If they
# changed, rebuild lexer.wasm, regenerate the derived modules, run the tests, commit,
# tag a patch release, and create a GitHub release. Publishing the release to npm is
# a separate, manually-triggered step - see publish.yml.
on:
schedule:
- cron: "30 3 * * *"
workflow_dispatch:
permissions:
contents: write
actions: write # self re-enable (see below)
concurrency:
group: sync
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# GitHub disables cron workflows after 60 days without repository activity;
# quiet periods upstream would otherwise silently stop the sync. Re-enabling is
# idempotent and counts as activity.
- name: Keep the schedule alive
run: gh api -X PUT "repos/${{ github.repository }}/actions/workflows/sync.yml/enable"
env:
GH_TOKEN: ${{ github.token }}
- name: Sync lexer sources from ClickHouse master
id: sync
run: |
set +e
bash scripts/sync.sh
status=$?
set -e
case $status in
0) echo "changed=true" >> "$GITHUB_OUTPUT" ;;
2) echo "changed=false" >> "$GITHUB_OUTPUT" ;;
*) exit $status ;;
esac
- if: steps.sync.outputs.changed == 'true'
uses: actions/setup-node@v4
with:
node-version: 22
- if: steps.sync.outputs.changed == 'true'
run: sudo apt-get update && sudo apt-get install -y clang lld
- if: steps.sync.outputs.changed == 'true'
name: Rebuild and test
run: |
npm run build
npm test
- if: steps.sync.outputs.changed == 'true'
name: Commit, tag and release
id: release
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
UPSTREAM=$(cat upstream/COMMIT)
git add -A
git commit -m "Sync lexer from ClickHouse/ClickHouse@${UPSTREAM}"
VERSION=$(npm version patch -m "Release %s")
git push --follow-tags
gh release create "$VERSION" \
--title "$VERSION" \
--notes "Lexer synced from [ClickHouse/ClickHouse@${UPSTREAM}](https://github.com/ClickHouse/ClickHouse/commit/${UPSTREAM})."
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}