Skip to content

Commit 5a189b0

Browse files
committed
chore: setup a cd workflow
1 parent 2d76fd2 commit 5a189b0

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/cd.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
name: Publish
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
deployments: write
16+
steps:
17+
- name: Checkout Source Code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Rust
21+
uses: dtolnay/rust-toolchain@stable
22+
23+
- name: Setup Rust Cache
24+
uses: Swatinem/rust-cache@v2
25+
26+
- name: Setup Cargo Binstall
27+
uses: cargo-bins/cargo-binstall@main
28+
29+
- name: Install Rust Binaries
30+
run: cargo binstall -y --force mdbook
31+
32+
- name: Build
33+
run: mdbook build
34+
35+
- name: Publish
36+
uses: cloudflare/wrangler-action@v3
37+
with:
38+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
39+
accountId: ${{ secrets.CF_ACCOUNT_ID }}
40+
command: pages deploy ./book --project-name=${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }} --branch=main
41+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)