Skip to content

Commit 3c6127a

Browse files
committed
test
1 parent 49a7157 commit 3c6127a

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

.github/workflows/convert-to-qmd.yml

+28-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111

1212
permissions:
1313
contents: write # Ensure the job has write permissions
14+
issues: write # Required for API calls to create and delete deploy keys
1415

1516
steps:
1617
- name: Checkout the Linear_Algebra_with_Python repository
@@ -29,11 +30,32 @@ jobs:
2930
quarto convert "$notebook" -o "converted_chapters/$(basename "$notebook" .ipynb).qmd"
3031
done
3132
33+
- name: Generate SSH Key
34+
run: |
35+
ssh-keygen -t rsa -b 4096 -C "actions@github.com" -f /tmp/github_actions -N ""
36+
echo "::set-output name=ssh-public-key::$(cat /tmp/github_actions.pub)"
37+
38+
- name: Add SSH Key to the SSH Agent
39+
run: |
40+
eval "$(ssh-agent -s)"
41+
ssh-add /tmp/github_actions
42+
43+
- name: Add Deploy Key to GitHub
44+
id: add_deploy_key
45+
run: |
46+
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
47+
-H "Accept: application/vnd.github.v3+json" \
48+
https://api.github.com/repos/weijie-chen/weijie-chen.github.io/keys \
49+
-d "{\"title\":\"GitHub Actions Key\",\"key\":\"$(cat /tmp/github_actions.pub)\",\"read_only\":false}" \
50+
-o deploy_key.json
51+
echo "::set-output name=deploy-key-id::$(jq -r .id deploy_key.json)"
52+
3253
- name: Checkout the weijie-chen.github.io repository
3354
uses: actions/checkout@v4.1.7
3455
with:
3556
repository: weijie-chen/weijie-chen.github.io
3657
path: book_repo
58+
ssh-key: /tmp/github_actions # Use the dynamically generated SSH key
3759

3860
- name: Copy Converted QMD Files to Book Repository
3961
run: |
@@ -50,11 +72,6 @@ jobs:
5072
sed -i '/<section class="table-of-contents">/,/<\/section>/{//!d}' book_repo/linear-algebra-with-python-book/index.html
5173
sed -i "/<section class=\"table-of-contents\">/a $toc" book_repo/linear-algebra-with-python-book/index.html
5274
53-
- name: Set up SSH Agent
54-
uses: webfactory/ssh-agent@v0.5.3
55-
with:
56-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
57-
5875
- name: Commit and Push Changes via SSH
5976
run: |
6077
cd book_repo
@@ -64,3 +81,9 @@ jobs:
6481
git add linear-algebra-with-python-book/index.html
6582
git commit -m "Updated chapters and Table of Contents"
6683
git push git@github.com:weijie-chen/weijie-chen.github.io.git main
84+
85+
- name: Clean Up - Remove Deploy Key from GitHub
86+
run: |
87+
DEPLOY_KEY_ID=$(jq -r .id deploy_key.json)
88+
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
89+
https://api.github.com/repos/weijie-chen/weijie-chen.github.io/keys/$DEPLOY_KEY_ID

notebooks/Chapter 2 - Basic Matrix Algebra.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"outputs": [],
2929
"source": [
3030
"from IPython.core.interactiveshell import InteractiveShell\n",
31-
"InteractiveShell.ast_node_interactivity = \"all\" # display multiple lines"
31+
"InteractiveShell.ast_node_interactivity = \"all\" # display multiple lines."
3232
]
3333
},
3434
{

0 commit comments

Comments
 (0)