-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.55 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Freenet Deploy
on:
push:
branches:
- main # Deploy when pushing to main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
# Checkout the repository
- uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
# Setup Hugo for static site generation
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.133.1'
extended: true
# Setup Rust environment
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
# Add WebAssembly target for Rust
- name: Add WebAssembly target
run: rustup target add wasm32-unknown-unknown
# Install WebAssembly tools
- name: Install wasm-pack and wasm-bindgen-cli
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cargo install --force wasm-pack
cargo install --force wasm-bindgen-cli
# Install cargo-make for building
- name: Install cargo-make
run: cargo install --debug cargo-make
# Cache WebAssembly files
- name: Cache WebAssembly files
id: cache-wasm
uses: actions/cache@v3
with:
path: hugo-site/static/wasm
key: ${{ runner.os }}-wasm-${{ hashFiles('rust/gkwasm/**', 'rust/gklib/**') }}
# Build WebAssembly if cache miss or files changed
- name: Build WebAssembly
if: steps.cache-wasm.outputs.cache-hit != 'true'
run: cargo make build-wasm-release
# Build the site using cargo-make
- name: Build Site
run: cargo make build-site
# Verify the contents of the build
- name: Verify WebAssembly files in build
run: |
echo "Contents of hugo-site/public/wasm:"
ls -la hugo-site/public/wasm
# Upload the built site to GitHub Pages artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: hugo-site/public # Point to the correct directory
deploy:
needs: build
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
steps:
# Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
with:
cname: freenet.org