-
Notifications
You must be signed in to change notification settings - Fork 38
99 lines (83 loc) · 3.16 KB
/
publish-example-tutorials.yaml
File metadata and controls
99 lines (83 loc) · 3.16 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
ref: main
- name: Checkout Docs Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: immutable/docs
token: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
path: imx-docs
ref: DVR-295-docs-restructure
- 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: Create Pull Request in Docs Repo
id: create_pr
run: |
cd "$CLONE_DIR"
if ! git status --porcelain | grep -q .; then
echo "No changes to commit"
echo "pr_url=" >> $GITHUB_OUTPUT
exit 0
fi
BRANCH_NAME="chore/sdk-docs-update-${{ github.run_id }}"
git checkout -b $BRANCH_NAME
git add .
git commit -m "Update example app tutorials from SDK repo"
git push -u origin $BRANCH_NAME
echo "Successfully pushed changes to docs repo on branch $BRANCH_NAME"
PR_URL=$(gh pr create \
--title "Update example app tutorials from SDK repo" \
--body "Automated PR from ts-immutable-sdk to update tutorials. Review and merge if all looks good." \
--base DVR-295-docs-restructure \
--repo immutable/docs)
echo "Successfully created PR in docs repo: $PR_URL"
echo "pr_url=${PR_URL}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
shell: bash
# - name: Notify Slack of New Docs PR
# if: steps.create_pr.outputs.pr_url != ''
# uses: slackapi/slack-github-action@v1.26.0
# with:
# channel-id: ${{ secrets.DOCS_PR_SLACK_CHANNEL_ID }}
# slack-message: "New automated tutorials PR is ready for review: <${{ steps.create_pr.outputs.pr_url }}|View Pull Request>"
# env:
# SLACK_BOT_TOKEN: ${{ secrets.DOCS_PR_SLACK_BOT_TOKEN }}