File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ name: Main
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ publish_artifacts :
7+ description : " Publish artifacts (Y|N)"
8+ required : true
9+ default : " N"
510 release :
611 types : [published]
712 push :
5055 with :
5156 name : site
5257 path : site.zip
58+
59+ publish :
60+ if : github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_artifacts == 'Y')
61+ needs : build
62+ runs-on : ubuntu-latest
63+
64+ steps :
65+ - name : Checkout repository
66+ uses : actions/checkout@v1
67+ with :
68+ fetch-depth : 1
69+
70+ - name : Download artifact
71+ uses : actions/download-artifact@v3
72+ with :
73+ name : site
74+ path : site
75+
76+ - name : Unzip artifact
77+ run : |
78+ unzip site/site.zip -d site
79+
80+ - name : Deploy to gh-pages branch
81+ run : |
82+ git config user.name "${GITHUB_ACTOR}"
83+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
84+ git checkout --orphan gh-pages
85+ git reset --hard
86+ mv site/* .
87+ rm -rf site
88+ git clean -fdx
89+ remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
90+ git add .
91+ git commit -m "Deploy documentation to gh-pages"
92+ git push --force $remote_repo gh-pages
You can’t perform that action at this time.
0 commit comments