forked from Azure/iotedgedev
-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (47 loc) · 1.6 KB
/
wiki.yml
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
name: updateWiki
on:
push:
branches: [master, eliises/add-docs]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push documentation changes to wiki
env:
EMAIL: [email protected]
USER_NAME: "Github Actions"
REPO_DEST: iotedgedev.wiki
REPO_DEST_URL: github.com/Azure/iotedgedev.wiki.git
INPUT_GITHUB_TOKEN: ${{ secrets.PUBLISH_SITE_TOKEN }}
run: |
set -e
ls -ahl
# Save iotedgedev repo folder path
REPO_SOURCE=$(pwd)
# Exit iotedgedev repo folder
cd ..
ls -ahl
# Clone repositories
git clone https://${REPO_DEST_URL}
# Update wiki repository with documentation folder contents
cd ${REPO_DEST}
git rm -rf .
git clean -fxd
yes | cp -rf ${REPO_SOURCE}/docs/* .
git reset
# Terminate CI build when no changes detected
if git diff-index --quiet HEAD && [ ! -n "$(git status -s)" ]; then
set +e
pkill -9 -P $$ &> /dev/null || true
exit 0
else
git config user.email ${EMAIL}
git config user.name ${USER_NAME}
git status
git add .
git commit -m "Update documentation | Azure devops build number ${GITHUB_ACTION}"
git push "https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@${REPO_DEST_URL}" HEAD:master
fi