-
Notifications
You must be signed in to change notification settings - Fork 28
130 lines (103 loc) · 3.57 KB
/
gh-pages.yml
File metadata and controls
130 lines (103 loc) · 3.57 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Generate and deploy documents
on:
push:
branches:
- master
workflow_dispatch:
env:
## コンテキスト
DOCUMENT_BRANCH: "gh-pages"
jobs:
build:
name: Generate document
permissions:
actions: write
checks: write
contents: write
runs-on: ubuntu-24.04
steps:
- name: Set current datetime as env variable
env:
TZ: 'Asia/Tokyo' # Set timezone
run: echo "CURRENT_DATETIME=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set git-configs
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git config push.default current
- name: Load environment variables from .env file
run: |
for line in $(grep -v '^#' ./doxygen/.env.pages); do
echo $line >> $GITHUB_ENV
done
# - name: check env
# run: ls -a
# - name: check env
# run: cat .gitmodules
# - name: Update submodules
# run: git submodule update --init "jothepro/doxygen-awesome-css"
- name: Make document (run docker compose)
run: docker compose --env-file .env.pages up && docker compose down
working-directory: ./doxygen
- name: Run after process
run: docker run --rm --name ofr-doc-after -v $GITHUB_WORKSPACE:/usr/src/myapp -w /usr/src/myapp/doxygen python:3.9.16-bullseye python after_process.py $DOXYGEN_HTML_OUTPUT_DIR
- name: Change owner
run: |
sudo chown -R runner:docker ./$DOXYGEN_HTML_OUTPUT_DIR
sudo chown -R runner:docker ./xml
- name: Back directory
run: cp -r ./$DOXYGEN_HTML_OUTPUT_DIR ~/backup
- name: Reset All
run: git checkout .
- name: Switch branch
run: | # ブランチが無い場合は新規作成し、ある場合は切り替える
git switch ${{ env.DOCUMENT_BRANCH }} 2>/dev/null || git switch --orphan ${{ env.DOCUMENT_BRANCH }}
- name: Restore directory
run: cp -rf ~/backup/* ./$DOXYGEN_HTML_OUTPUT_DIR
- name: Commit and push
continue-on-error: true
run: |
git add $DOXYGEN_HTML_OUTPUT_DIR/
git commit -m "$CURRENT_DATETIME"
git push
deploy:
name: Deploy pages
needs: build
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Load environment variables from .env file
run: |
for line in $(grep -v '^#' ./doxygen/.env.pages); do
echo $line >> $GITHUB_ENV
done
- name: Switch to document branch
run: git switch ${{ env.DOCUMENT_BRANCH }}
- name: Setup Pages
uses: actions/configure-pages@v4
# - name: check env
# run: printenv
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
# Upload entire repository
path: ${{ env.DOXYGEN_HTML_OUTPUT_DIR }}
#path: "./testpages"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4