File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 7
7
jobs :
8
8
build :
9
9
runs-on : ubuntu-latest
10
+ outputs :
11
+ commit-info : ${{ steps.commit-info.outputs.COMMIT_INFO }}
10
12
steps :
11
13
- uses : actions/checkout@v4
12
14
with :
@@ -64,29 +66,47 @@ jobs:
64
66
with :
65
67
path : site
66
68
69
+ - name : Generate commit info
70
+ id : commit-info
71
+ run : |
72
+ git log -1 --pretty="COMMIT_INFO=%an: [%h] %s" >> "$GITHUB_OUTPUT"
73
+
67
74
deploy :
68
75
needs : build
69
76
if : github.ref == 'refs/heads/master'
70
77
environment :
71
78
name : github-pages
72
79
url : ${{ steps.deployment.outputs.page_url }}
80
+ permissions :
81
+ contents : write
82
+ pages : write
83
+ id-token : write
73
84
runs-on : ubuntu-latest
74
85
steps :
75
86
- name : Deploy to GitHub Pages
76
87
id : deployment
77
88
uses : actions/deploy-pages@v4
78
89
90
+ - name : Download artifact
91
+ uses : actions/download-artifact@v5
92
+ with :
93
+ name : github-pages
94
+ path : site/
95
+
79
96
- name : Push site to gh-pages branch
80
97
run : |
81
- CINFO="$(git log -1 --pretty="%an: [%h] %s")"
82
98
git clone --depth=1 --branch=gh-pages --single-branch --no-checkout \
83
- "https://${GITHUB_ACTOR} :${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY }.git" test
99
+ "https://${{ github.actor }} :${{ github.token }}@github.com/${{ github.repository } }.git" test
84
100
mv test/.git site/.git && rmdir test/
85
101
pushd site/ &>/dev/null
102
+ if [ -f artifact.tar ]; then
103
+ tar xf artifact.tar
104
+ rm artifact.tar
105
+ fi
86
106
git add -A
87
107
git -c user.name=GitHub -c [email protected] commit \
88
108
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
89
- -m "$CINFO " \
109
+ -m "${{ needs.build.outputs.commit-info }} " \
90
110
--allow-empty
91
111
git push
92
112
popd &>/dev/null
You can’t perform that action at this time.
0 commit comments