-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (56 loc) · 1.96 KB
/
docs-sync.yml
File metadata and controls
63 lines (56 loc) · 1.96 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
name: Docs Sync
on:
push:
branches:
- main
paths:
- 'docs/**'
workflow_dispatch:
jobs:
docs_sync:
name: Docs Sync
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
env:
GH_TOKEN: '${{ secrets.GH_TOKEN }}'
TARGET_DIR: 'node-sdk'
steps:
- name: Check out ${{ env.TARGET_DIR }}
uses: actions/checkout@v4
with:
fetch-depth: 2
path: ./${{ env.TARGET_DIR }}
- name: Check out docs
uses: actions/checkout@v4
with:
fetch-depth: 2
repository: salable/docs
path: './docs'
token: ${{ secrets.GH_TOKEN }}
- name: Migrate Code to docs repo
run: |
# Remove the old folders in the docs repo
rm -rf ./docs/${{ env.TARGET_DIR }}
rm -rf ./docs/${{ env.TARGET_DIR }}_versioned_docs
rm -rf ./docs/${{ env.TARGET_DIR }}_versioned_sidebars
rm -rf ./docs/${{ env.TARGET_DIR }}_versions.json
# Move in the new folders
mv ./${{ env.TARGET_DIR }}/docs/docs ./docs/${{ env.TARGET_DIR }}
mv ./${{ env.TARGET_DIR }}/docs/versioned_docs ./docs/${{ env.TARGET_DIR }}_versioned_docs
mv ./${{ env.TARGET_DIR }}/docs/versioned_sidebars ./docs/${{ env.TARGET_DIR }}_versioned_sidebars
mv ./${{ env.TARGET_DIR }}/docs/versions.json ./docs/${{ env.TARGET_DIR }}_versions.json
# Commit the changes
cd ./docs
git config user.name "Salable App"
git config user.email "<dev@salable.app>"
git config --global credential.helper cache
git add ./${{ env.TARGET_DIR }}
git add ./${{ env.TARGET_DIR }}_versioned_docs
git add ./${{ env.TARGET_DIR }}_versioned_sidebars
git add ./${{ env.TARGET_DIR }}_versions.json
git status
git commit -m "docs: synced with ${{ env.TARGET_DIR }} documentation"
git push