Skip to content

Commit 82ed19d

Browse files
CI: Use a deploy key for pushing to gh-pages.
1 parent 48bd599 commit 82ed19d

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

.github/workflows/publish_docs_to_pages.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,32 @@ jobs:
3030
make html
3131
mv build/html /tmp
3232
cd ..
33-
- name: Prepare local gh-pages branch
33+
- name: Deploy to gh-pages branch
3434
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
GH_ACTION_PAGES_DEPLOY_KEY: ${{ secrets.GH_ACTION_PAGES_DEPLOY_KEY }}
3636
run: |
37-
#git remote rm origin
38-
#git remote add origin "https://${GITHUB_TOKEN}@github.com/numpy/numpy-financial.git"
39-
git config user.email "github.workflow@nomail"
40-
git config user.name "none"
37+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
38+
# Set up SSH key
39+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
40+
mkdir -p ~/.ssh/
41+
echo "$GH_ACTION_PAGES_DEPLOY_KEY" > ~/.ssh/id_rsa
42+
chmod 600 ~/.ssh/id_rsa
43+
ssh-keyscan github.com >> ~/.ssh/known_hosts
44+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45+
# Reconfigure the git remote to use SSH
46+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47+
git remote rm origin
48+
git remote add origin [email protected]:numpy/numpy-financial.git
49+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50+
# Configure the git user
51+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
52+
git config user.name "${GITHUB_ACTOR}"
53+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
54+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55+
# Go to work on gh-pages...
56+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4157
echo "Fetching gh-pages"
42-
git fetch "https://${GITHUB_TOKEN}@github.com/numpy/numpy-financial.git" gh-pages
58+
git fetch origin gh-pages
4359
echo "Checking out gh-pages branch"
4460
git checkout gh-pages
4561
echo "Removing old documentation"
@@ -53,9 +69,5 @@ jobs:
5369
echo "Adding new documentation"
5470
git add -A
5571
git commit -m "Add new documentation"
56-
- name: Push the new documentation to gh-pages
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
run: |
6072
echo "Pushing new documentation to origin"
61-
git push -v "https://${GITHUB_TOKEN}@github.com/numpy/numpy-financial.git" gh-pages
73+
git push -v origin gh-pages

0 commit comments

Comments
 (0)