44 push :
55 branches :
66 - master
7+ workflow_dispatch :
78
89env :
910 # # コンテキスト
@@ -16,16 +17,17 @@ jobs:
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 :
2324 TZ : ' Asia/Tokyo' # Set timezone
2425 run : echo "CURRENT_DATETIME=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
2526
2627 - name : Checkout code
27- uses : actions/checkout@v3
28+ uses : actions/checkout@v4
2829 with :
30+ submodules : recursive
2931 fetch-depth : 0
3032
3133 - name : Set git-configs
@@ -34,36 +36,20 @@ jobs:
3436 git config user.email [email protected] 3537 git config push.default current
3638
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-
5639 - name : Load environment variables from .env file
5740 run : |
5841 for line in $(grep -v '^#' ./doxygen/.env.pages); do
5942 echo $line >> $GITHUB_ENV
6043 done
6144
6245 # - name: check env
63- # run: printenv
46+ # run: ls -a
47+
48+ # - name: check env
49+ # run: cat .gitmodules
6450
65- - name : Update submodules
66- run : git submodule update --init -- "doxygen /doxygen-awesome-css"
51+ # - name: Update submodules
52+ # run: git submodule update --init "jothepro /doxygen-awesome-css"
6753
6854 - name : Make document (run docker compose)
6955 run : docker compose --env-file .env.pages up && docker compose down
@@ -77,26 +63,19 @@ jobs:
7763 sudo chown -R runner:docker ./$DOXYGEN_HTML_OUTPUT_DIR
7864 sudo chown -R runner:docker ./xml
7965
80- - name : Add Stash
81- run : |
82- git add ./$DOXYGEN_HTML_OUTPUT_DIR
83- git stash push -- ./$DOXYGEN_HTML_OUTPUT_DIR
66+ - name : Back directory
67+ run : cp -r ./$DOXYGEN_HTML_OUTPUT_DIR ~/backup
8468
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-
69+ - name : Reset All
70+ run : git checkout .
71+
72+ - name : Switch branch
73+ run : | # ブランチが無い場合は新規作成し、ある場合は切り替える
74+ git switch ${{ env.DOCUMENT_BRANCH }} 2>/dev/null || git switch --orphan ${{ env.DOCUMENT_BRANCH }}
75+
76+ - name : Restore directory
77+ run : cp -rf ~/backup/* ./$DOXYGEN_HTML_OUTPUT_DIR
78+
10079 - name : Commit and push
10180 continue-on-error : true
10281 run : |
11796 url : ${{ steps.deployment.outputs.page_url }}
11897 steps :
11998 - name : Checkout
120- uses : actions/checkout@v3
99+ uses : actions/checkout@v4
121100 with :
122101 fetch-depth : 0
123102
@@ -131,21 +110,21 @@ jobs:
131110 run : git switch ${{ env.DOCUMENT_BRANCH }}
132111
133112 - name : Setup Pages
134- uses : actions/configure-pages@v3
113+ uses : actions/configure-pages@v4
135114
136115 # - name: check env
137116 # run: printenv
138117
139118 - name : Upload artifact
140- uses : actions/upload-pages-artifact@v1
119+ uses : actions/upload-pages-artifact@v3
141120 with :
142121 # Upload entire repository
143122 path : ${{ env.DOXYGEN_HTML_OUTPUT_DIR }}
144123 # path: "./testpages"
145124
146125 - name : Deploy to GitHub Pages
147126 id : deployment
148- uses : actions/deploy-pages@v2
127+ uses : actions/deploy-pages@v4
149128
150129
151130
0 commit comments