-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (70 loc) · 2.39 KB
/
update-documentation.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
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
name: Update the documentation website
on:
workflow_dispatch:
push:
branches:
- main
jobs:
Update-Submodules:
runs-on: ubuntu-latest
if: startsWith(github.repository, 'osg-htc/')
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
fetch-depth: 0
- name: Pull, Merge, Push submodules
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git submodule update --remote --merge
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update Documentation"
git push
else
echo "no changes";
fi
Build-Static-Site:
runs-on: ubuntu-latest
if: startsWith(github.repository, 'osg-htc/')
needs: Update-Submodules
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Initialize GH User
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Update the Submodule pulled
run: |
git submodule update --recursive --remote
- name: Build MkDocs pages
if: startsWith(github.repository, 'osg-htc/')
uses: docker://squidfunk/mkdocs-material:8.2.8
with:
args: >-
build
--verbose
- name: Deploy to 'static' branch
run: |
# Commit the build then use 'git subtree' to create a branch with just the site contents
git add site -f
git commit -m "Build Static HTML"
git checkout -b static `git subtree split --prefix site main`
# Push to Production
git push --set-upstream origin static --force
Trigger-New-Documentation-Release:
runs-on: ubuntu-latest
if: startsWith(github.repository, 'osg-htc/')
needs: [Build-Static-Site, Update-Submodules]
env:
OWNER: "osg-htc"
REPO: "path-portal"
WORKFLOW_ID: "release-documentation-update.yml"
steps:
- name: Trigger Documentation Release
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.REPO_ACCESS_TOKEN }}" https://api.github.com/repos/${{env.OWNER}}/${{env.REPO}}/actions/workflows/${{env.WORKFLOW_ID}}/dispatches -d '{"ref":"master"}'