Skip to content

Commit a2faf06

Browse files
committed
Refactor GitHub Actions workflow for website deployment; improve job structure and remove unnecessary steps
1 parent 115d7d6 commit a2faf06

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed
Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
name: website
1+
name: Deploy Website
22

33
on:
44
push:
55
branches: [website]
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
68

79
jobs:
810
checks:
@@ -24,32 +26,31 @@ jobs:
2426
gh-release:
2527
if: github.event_name != 'pull_request'
2628
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
pages: write
32+
id-token: write
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
2736
steps:
28-
- uses: actions/checkout@v3
29-
- uses: actions/setup-node@v3
37+
- name: Checkout
38+
uses: actions/checkout@v3
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v3
3041
with:
3142
node-version: '20.x'
3243
cache: 'yarn'
33-
- name: Add key to allow access to repository
34-
env:
35-
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
36-
run: |
37-
mkdir -p ~/.ssh
38-
ssh-keyscan github.com >> ~/.ssh/known_hosts
39-
echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa
40-
chmod 600 ~/.ssh/id_rsa
41-
cat <<EOT >> ~/.ssh/config
42-
Host github.com
43-
HostName github.com
44-
IdentityFile ~/.ssh/id_rsa
45-
EOT
4644
- name: Install dependencies
4745
run: yarn install --frozen-lockfile
48-
- name: Release to GitHub Pages
49-
env:
50-
USE_SSH: true
51-
GIT_USER: git
52-
run: |
53-
git config --global user.email "[email protected]"
54-
git config --global user.name "gh-actions"
55-
yarn docusaurus deploy
46+
- name: Build website
47+
run: yarn build
48+
- name: Setup Pages
49+
uses: actions/configure-pages@v3
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@v2
52+
with:
53+
path: './build'
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)