-
Notifications
You must be signed in to change notification settings - Fork 38
79 lines (66 loc) · 2.22 KB
/
publish-example-tutorials.yaml
File metadata and controls
79 lines (66 loc) · 2.22 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
79
name: Publish Example App Tutorials
on:
# Run when changes are pushed to example tutorials or metadata
push:
branches:
- main
paths:
- 'examples/*/*/tutorial.md'
- 'examples/*/*/metadata.json'
- 'examples/*/*/features.json'
# Allow manual triggering
workflow_dispatch:
concurrency:
group: example-tutorials
cancel-in-progress: false
jobs:
PublishExampleTutorials:
name: Process and Publish Example Tutorials
runs-on: ubuntu-latest
steps:
- name: Checkout SDK Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6.0.1
with:
fetch-depth: 0
ref: main
- name: Checkout Docs Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6.0.1
with:
repository: immutable/docs
token: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
path: imx-docs
ref: main
- name: Setup environment variables
run: |
echo "CLONE_DIR=./imx-docs" >> $GITHUB_ENV
- name: Setup Github
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: setup
uses: ./.github/actions/setup
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Process Example App Tutorials
run: |
# Generate example app JSON files
pnpm parse:examples
# Process tutorials and copy to docs repo
./.github/scripts/process-tutorials.sh
shell: bash
- name: Commit and Push Changes to Docs Repo
run: |
cd "$CLONE_DIR"
# Check if there are changes to commit
if git status --porcelain | grep -q .; then
# Add all changes
git add .
# Commit the changes
git commit -m "Update example app tutorials from SDK repo"
# Push to the target branch
git push -u origin main
echo "Successfully pushed example app tutorial changes to docs repo"
else
echo "No changes to commit"
fi
shell: bash