Skip to content

Commit b56b2a3

Browse files
authored
Merge pull request #44 from namiba-work/main
Adding a cloudflare deployment yaml file
2 parents 31d1aff + d589c38 commit b56b2a3

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release to Cloudflare Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write # for committing branch.
10+
pages: write
11+
id-token: write
12+
13+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
14+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
Cloudflare-Pages-Release:
21+
22+
timeout-minutes: 10
23+
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v4 # repo checkout
28+
29+
# Install Rust Nightly Toolchain, with Clippy & Rustfmt
30+
- name: Install nightly Rust
31+
uses: dtolnay/rust-toolchain@nightly
32+
with:
33+
components: clippy, rustfmt
34+
35+
- name: Add WASM target
36+
run: rustup target add wasm32-unknown-unknown
37+
38+
- name: lint
39+
run: cargo clippy & cargo fmt --check
40+
41+
# If using tailwind...
42+
# - name: Download and install tailwindcss binary
43+
# run: npm install -D tailwindcss && npx tailwindcss -i <INPUT/PATH.css> -o <OUTPUT/PATH.css> # run tailwind
44+
45+
- name: Download and install Trunk binary
46+
run: wget -qO- https://github.com/trunk-rs/trunk/releases/download/v0.21.14/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
47+
48+
- name: Build with Trunk
49+
# "${GITHUB_REPOSITORY#*/}" evaluates into the name of the repository
50+
# using --public-url something will allow trunk to modify all the href
51+
# paths like from favicon.ico to repo_name/favicon.ico . this is
52+
# necessary for github pages where the site is deployed to
53+
# username.github.io/repo_name and all files must be requested
54+
# relatively as favicon.ico. if we skip public-url option, the href
55+
# paths will instead request username.github.io/favicon.ico which will
56+
# obviously return error 404 not found.
57+
run: ./trunk build --release
58+
59+
60+
# Deploy
61+
- name: Publish to Cloudflare Pages
62+
uses: cloudflare/pages-action@v1
63+
with:
64+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
65+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
66+
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
67+
directory: './dist'
68+
# Optional: Enable this if you want to have GitHub Deployments triggered
69+
# gitHubToken: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)