-
Notifications
You must be signed in to change notification settings - Fork 3.9k
66 lines (57 loc) · 1.74 KB
/
merge-json-samples.yaml
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
name: Merge and Distribute Samples
on:
push:
branches:
- main
paths:
- 'samples/**'
pull_request:
branches:
- main
types: [closed]
jobs:
process_samples:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true || github.event_name == 'push'
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: 'main'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Merge samples
run: node .github/scripts/merge-samples/index.js
- name: Commit merged samples.json on main
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add -A
git diff --staged --quiet || git commit -m "Automated samples.json update"
git push
- name: Checkout Docs branch
uses: actions/checkout@v3
with:
ref: 'Docs'
path: 'docs-branch'
- name: Copy samples.json to Docs branch
run: |
cp .metadata/samples.json docs-branch/docs/samples.json
cd docs-branch
git add -A
git diff --staged --quiet || git commit -m "Update samples.json in Docs branch"
git push
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: 'gh-pages'
path: 'gh-pages-branch'
- name: Copy samples.json to gh-pages branch
run: |
cp .metadata/samples.json gh-pages-branch/samples.json
cd gh-pages-branch
git add -A
git diff --staged --quiet || git commit -m "Update samples.json in gh-pages branch"
git push