Skip to content

Commit 85c4399

Browse files
authored
Merge pull request #60 from chkware/47-custom-github-actions
feat: deploy to GitHub Pages using custom `GitHub Actions`
2 parents 7f9524f + 388e4f1 commit 85c4399

1 file changed

Lines changed: 36 additions & 14 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,33 @@ on:
55
branches:
66
- main
77

8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
819
jobs:
9-
deploy:
10-
name: Deploy to GitHub Pages
20+
build:
1121
runs-on: ubuntu-latest
1222
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v3
23+
- uses: actions/checkout@v3
1524

16-
- name: Set up Node
17-
uses: actions/setup-node@v3
25+
- uses: actions/setup-node@v3
1826
with:
1927
node-version: 18.x
28+
cache: 'npm'
29+
cache-dependency-path: ./package-lock.json
30+
31+
- name: Setup Pages
32+
uses: actions/configure-pages@v3
2033

21-
- name: Cache dependencies
34+
- name: Restore cache
2235
uses: actions/cache@v3
2336
with:
2437
path: |
@@ -28,13 +41,22 @@ jobs:
2841
- name: Install dependencies
2942
run: npm ci
3043

31-
- name: Build
44+
- name: Build with docusaurus
3245
run: npm run build
3346

34-
- name: Deploy to GitHub Pages
35-
uses: peaceiris/actions-gh-pages@v3
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v1
3649
with:
37-
github_token: ${{ secrets.GITHUB_TOKEN }}
38-
publish_dir: ./build
39-
user_name: github-actions[bot]
40-
user_email: 41898282+github-actions[bot]@users.noreply.github.com
50+
path: ./build
51+
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
57+
runs-on: ubuntu-latest
58+
needs: build
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)