generated from mhyfritz/astro-landing-page
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 1.83 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Build and Deploy to GitHub Pages
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm rustup nodejs npm jq curl git tar gzip
- name: Setup Rust
run: |
rustup install stable
rustup default stable
- name: Download and setup mdBook
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/rust-lang/mdBook/releases/latest | jq -r ".tag_name")
curl -LO "https://github.com/rust-lang/mdBook/releases/download/${LATEST_RELEASE}/mdbook-${LATEST_RELEASE}-x86_64-unknown-linux-gnu.tar.gz"
tar xzf mdbook-${LATEST_RELEASE}-x86_64-unknown-linux-gnu.tar.gz -C /usr/local/bin
- name: Build mdBook
run: |
mdbook build docs
- name: Setup Node.js
run: |
LATEST_NODE=$(curl -s https://api.github.com/repos/nodejs/node/releases/latest | jq -r ".tag_name")
curl -LO "https://nodejs.org/dist/${LATEST_NODE}/node-${LATEST_NODE}-linux-x64.tar.gz"
tar xzf node-${LATEST_NODE}-linux-x64.tar.gz
export PATH=$PATH:$(pwd)/node-${LATEST_NODE}-linux-x64/bin
- name: Install and build Astro project
run: |
npm install
npm run build
- name: Move mdBook to Astro docs folder
run: |
mkdir -p dist/docs
mv docs/book/* dist/docs/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_PAT }}
publish_dir: ./dist