-
Notifications
You must be signed in to change notification settings - Fork 24
55 lines (52 loc) · 2.06 KB
/
main.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
name: Build-docs
on:
push:
branches:
- master
pull_request:
jobs:
build_job:
runs-on: ubuntu-latest
name: Build documentation
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Commit documentation changes
run: |
git clone https://github.com/edi33416/DSS-gh-pages.git github-pages
if test ${{ github.ref }} == 'refs/heads/master'; then
cp -r docs/* github-pages/docs
rm github-pages/docs/_config.yml
rm -rf github-pages/docs/_includes
# Set the right baseurl for Jekyll
#echo "baseurl: \"/docs\"" >> docs/_config.yml
#echo "url: \"https://edi33416.github.io/DSS-gh-pages\"" >> docs/_config.yml
else
mkdir -p github-pages/${{ github.ref }}
cp -r docs/* github-pages/${{ github.ref }}
rm github-pages/${{ github.ref }}/_config.yml
rm -rf github-pages/${{ github.ref }}/_includes
# Set the right baseurl for Jekyll
#echo "baseurl: \"/${{ github.ref }}\"" >> docs/_config.yml
#echo "url: \"https://edi33416.github.io/DSS-gh-pages\"" >> docs/_config.yml
fi
cp docs/_config.yml github-pages/
cp -r docs/_includes github-pages/
cd github-pages/
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m 'Update "${{ github.ref }}"' -a || true
git push https://${{ secrets.GH_PG_ACCESS_TOKEN }}@github.com/edi33416/DSS-gh-pages.git
- name: Add comment to PR
if: github.event_name == 'pull_request'
env:
URL: ${{ github.event.pull_request.comments_url }}
GITHUB_TOKEN: edi33416:${{ secrets.GH_PG_ACCESS_TOKEN }}
run: |
curl \
-X POST \
-u $GITHUB_TOKEN \
$URL \
-H "Content-Type: application/json" \
--data '{ "body": "Published at https://edi33416.github.io/DSS-gh-pages/${{ github.ref }}" }'