44 push :
55 branches :
66 - master
7+ workflow_dispatch :
78
89env :
910 # # コンテキスト
1617 actions : write
1718 checks : write
1819 contents : write
19- runs-on : ubuntu-22 .04
20+ runs-on : ubuntu-24 .04
2021 steps :
2122 - name : Set current datetime as env variable
2223 env :
3435 git config user.email [email protected] 3536 git config push.default current
3637
37- - name : Set whether the branch is already existing to GITHUB_ENV
38- run : |
39- branch_is_existing=$(
40- git fetch origin ${{ env.DOCUMENT_BRANCH }} &&
41- echo true ||
42- echo false
43- )
44- echo "BRANCH_IS_EXISTING=${branch_is_existing}" >> $GITHUB_ENV
45-
46- - name : Create branch if not exist
47- if : env.BRANCH_IS_EXISTING == 'false'
48- run : |
49- git switch --orphan ${{ env.DOCUMENT_BRANCH }}
50- touch .gitkeep
51- git add .gitkeep
52- git commit -m "initial commit"
53- git push
54- git switch master
55-
5638 - name : Load environment variables from .env file
5739 run : |
5840 for line in $(grep -v '^#' ./doxygen/.env.pages); do
6345 # run: printenv
6446
6547 - name : Update submodules
66- run : git submodule update --init -- "doxygen /doxygen-awesome-css"
48+ run : git submodule update --init -- "jothepro /doxygen-awesome-css"
6749
6850 - name : Make document (run docker compose)
6951 run : docker compose --env-file .env.pages up && docker compose down
@@ -77,26 +59,16 @@ jobs:
7759 sudo chown -R runner:docker ./$DOXYGEN_HTML_OUTPUT_DIR
7860 sudo chown -R runner:docker ./xml
7961
80- - name : Add Stash
81- run : |
82- git add ./$DOXYGEN_HTML_OUTPUT_DIR
83- git stash push -- ./$DOXYGEN_HTML_OUTPUT_DIR
62+ - name : Back directory
63+ run : cp -r ./$DOXYGEN_HTML_OUTPUT_DIR ~/backup
8464
85- - name : Reset changes
86- run : git reset --hard
87-
88- - name : Switch to document branch
89- run : git switch ${{ env.DOCUMENT_BRANCH }}
90-
91- - name : Remove unnecessary files
92- run : git clean -df
93-
94- # - name: ls
95- # run: ls -all
96-
97- - name : Apply stash
98- run : git checkout stash -- ./$DOXYGEN_HTML_OUTPUT_DIR
99-
65+ - name : Switch branch
66+ run : | # ブランチが無い場合は新規作成し、ある場合は切り替える
67+ git switch ${{ env.DOCUMENT_BRANCH }} 2>/dev/null || git switch --orphan ${{ env.DOCUMENT_BRANCH }}
68+
69+ - name : Restore directory
70+ run : cp -rf ~/backup/* ./$DOXYGEN_HTML_OUTPUT_DIR
71+
10072 - name : Commit and push
10173 continue-on-error : true
10274 run : |
@@ -131,21 +103,21 @@ jobs:
131103 run : git switch ${{ env.DOCUMENT_BRANCH }}
132104
133105 - name : Setup Pages
134- uses : actions/configure-pages@v3
106+ uses : actions/configure-pages@v4
135107
136108 # - name: check env
137109 # run: printenv
138110
139111 - name : Upload artifact
140- uses : actions/upload-pages- artifact@v1
112+ uses : actions/upload-artifact@v4
141113 with :
142114 # Upload entire repository
143115 path : ${{ env.DOXYGEN_HTML_OUTPUT_DIR }}
144116 # path: "./testpages"
145117
146118 - name : Deploy to GitHub Pages
147119 id : deployment
148- uses : actions/deploy-pages@v2
120+ uses : actions/deploy-pages@v4
149121
150122
151123
0 commit comments