1
- # name: Deploy to GitHub Pages
2
-
3
- # on:
4
- # push:
5
- # branches: [ deploy ]
6
- # workflow_dispatch:
7
-
8
- # permissions:
9
- # contents: write
10
-
11
- # jobs:
12
- # build-and-deploy:
13
- # runs-on: ubuntu-latest
14
- # steps:
15
- # - uses: actions/checkout@v2
16
- # with:
17
- # fetch-depth: 2 # Need history to check for changes
18
-
19
- # - name: Check for Rust changes
20
- # id: check_changes
21
- # run: |
22
- # # Check if any Rust files or Cargo.toml have changed
23
- # if git diff --name-only HEAD^ HEAD | grep -qE '\.rs$|Cargo.toml|Cargo.lock'; then
24
- # echo "rust_changed=true" >> $GITHUB_OUTPUT
25
- # else
26
- # echo "rust_changed=false" >> $GITHUB_OUTPUT
27
- # fi
28
-
29
- # - name: Install Rust
30
- # if: steps.check_changes.outputs.rust_changed == 'true'
31
- # uses: actions-rs/toolchain@v1
32
- # with:
33
- # toolchain: stable
34
- # target: wasm32-unknown-unknown
35
- # override: true
36
-
37
- # - name: Install wasm-bindgen-cli
38
- # if: steps.check_changes.outputs.rust_changed == 'true'
39
- # run: cargo install -f wasm-bindgen-cli --version 0.2.95
40
-
41
- # - name: Create deployment directory
42
- # run: mkdir -p dist
43
-
44
- # - name: Build WASM
45
- # if: steps.check_changes.outputs.rust_changed == 'true'
46
- # run: |
47
- # cargo build --release --target wasm32-unknown-unknown
48
- # wasm-bindgen --out-dir ./dist/out/ --target web ./target/wasm32-unknown-unknown/release/bevy_compute_shader.wasm
49
-
50
- # - name: Copy existing WASM files
51
- # if: steps.check_changes.outputs.rust_changed == 'false'
52
- # run: |
53
- # # Get the files from the previous gh-pages build
54
- # git fetch origin gh-pages
55
- # git checkout origin/gh-pages -- out
56
- # cp -r out dist/
57
-
58
- # - name: Copy web files
59
- # run: |
60
- # cp index.html dist/
61
- # cp styles.css dist/
62
- # cp -r assets dist/
63
-
64
- # - name: List files for debugging
65
- # run: |
66
- # echo "Deployment directory contents:"
67
- # ls -la dist/
68
- # echo "\nOut directory contents:"
69
- # ls -la dist/out/
70
- # echo "\nAssets directory contents:"
71
- # ls -la dist/assets/
72
-
73
- # - name: Deploy to GitHub Pages
74
- # uses: JamesIves/github-pages-deploy-action@v4
75
- # with:
76
- # folder: dist
77
- # branch: gh-pages
78
- # clean: true
79
-
80
1
name : Deploy to GitHub Pages
81
2
82
3
on :
@@ -93,56 +14,34 @@ jobs:
93
14
steps :
94
15
- uses : actions/checkout@v2
95
16
with :
96
- fetch-depth : 2 # Need history to check for changes
97
-
98
- - name : Check for Rust changes
99
- id : check_changes
100
- run : |
101
- # Check if any Rust files or Cargo.toml have changed
102
- if git diff --name-only HEAD^ HEAD | grep -qE '\.rs$|Cargo.toml|Cargo.lock'; then
103
- echo "rust_changed=true" >> $GITHUB_OUTPUT
104
- else
105
- echo "rust_changed=false" >> $GITHUB_OUTPUT
106
- fi
107
-
108
- - name : Check if gh-pages exists
109
- id : check_ghpages
110
- run : |
111
- if git ls-remote --heads origin gh-pages | grep -q 'gh-pages'; then
112
- echo "branch_exists=true" >> $GITHUB_OUTPUT
113
- else
114
- echo "branch_exists=false" >> $GITHUB_OUTPUT
115
- fi
17
+ fetch-depth : 2
116
18
117
19
- name : Install Rust
118
- if : steps.check_changes.outputs.rust_changed == 'true'
119
20
uses : actions-rs/toolchain@v1
120
21
with :
121
22
toolchain : stable
122
23
target : wasm32-unknown-unknown
123
24
override : true
25
+
26
+ - name : Add WASM target
27
+ run : rustup target add wasm32-unknown-unknown
28
+
29
+ - name : Install dependencies
30
+ run : |
31
+ sudo apt-get update
32
+ sudo apt-get install -y pkg-config libudev-dev libasound2-dev
124
33
125
34
- name : Install wasm-bindgen-cli
126
- if : steps.check_changes.outputs.rust_changed == 'true'
127
35
run : cargo install -f wasm-bindgen-cli --version 0.2.95
128
36
129
37
- name : Create deployment directory
130
38
run : mkdir -p dist
131
39
132
- - name : Build WASM
133
- if : steps.check_changes.outputs.rust_changed == 'true' || steps.check_ghpages.outputs.branch_exists == 'false'
40
+ - name : Build WASM (with verbose output)
134
41
run : |
135
- cargo build --release --target wasm32-unknown-unknown
42
+ cargo build --release --target wasm32-unknown-unknown -v
136
43
wasm-bindgen --out-dir ./dist/out/ --target web ./target/wasm32-unknown-unknown/release/bevy_vaporwave.wasm
137
44
138
- - name : Copy existing WASM files
139
- if : steps.check_changes.outputs.rust_changed == 'false' && steps.check_ghpages.outputs.branch_exists == 'true'
140
- run : |
141
- # Get the files from the previous gh-pages build
142
- git fetch origin gh-pages
143
- git checkout origin/gh-pages -- out
144
- cp -r out dist/
145
-
146
45
- name : Copy web files
147
46
run : |
148
47
cp index.html dist/
0 commit comments