Skip to content

Commit 084a179

Browse files
committed
Build and deploy docs from github actions
1 parent 62b6a36 commit 084a179

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source_up
2+
use asdf

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: ✍️ Document and 🚀 Deployment
2+
on:
3+
push:
4+
branches: [ main ]
5+
tags: [ "*" ]
6+
pull_request:
7+
workflow_dispatch:
8+
jobs:
9+
documents:
10+
name: "Build and deploy documentation"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: "3.9"
17+
18+
- name: Build documentation
19+
run: |
20+
python -m pip install --upgrade poetry
21+
poetry install
22+
poetry run mkdocs build
23+
24+
- name: Deploy PR preview to Surge
25+
uses: afc163/surge-preview@v1
26+
id: preview_step
27+
if: github.event_name == 'pull_request'
28+
with:
29+
surge_token: ${{ secrets.SURGE_TOKEN }}
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
dist: site
32+
teardown: 'true'
33+
build: |
34+
echo "mkdocs has built site/ already"
35+
- name: Get the preview_url
36+
if: github.event_name == 'pull_request'
37+
run: echo "${{ steps.preview_step.outputs.preview_url }}"
38+
39+
- name: Deploy to GitHub Pages
40+
uses: peaceiris/actions-gh-pages@v3
41+
if: github.ref == 'refs/heads/main'
42+
with:
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
publish_dir: ./site
45+
46+
- name: Deploy to Surge
47+
if: github.ref == 'refs/heads/main'
48+
run: |
49+
npx surge --project site \
50+
--domain mycurl.surge.sh \
51+
--token ${{ secrets.SURGE_TOKEN }}

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python 3.9.5
2+
nodejs 16.4.0

0 commit comments

Comments
 (0)