Skip to content

Commit

Permalink
add ghpages build script
Browse files Browse the repository at this point in the history
  • Loading branch information
hlorenzi committed Mar 20, 2021
1 parent d958f8b commit e9efbe4
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target/
/pkg/
/.pkgtemp/
/Cargo.lock
/Cargo.lock

/web/customasm.gc.wasm
4 changes: 4 additions & 0 deletions .gitignore.ghpages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target/
/pkg/
/.pkgtemp/
/Cargo.lock
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "customasm"
version = "0.11.4"
version = "0.11.5"
edition = "2018"
authors = ["hlorenzi <https://hlorenzi.com>"]
description = "An assembler for custom, user-defined instruction sets!"
Expand Down
24 changes: 24 additions & 0 deletions build_ghpages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Checkout a clean ghpages branch
git branch -D ghpages
git checkout -b ghpages

# Replace .gitignore
Remove-Item -Path .gitignore
Copy-Item -Path .gitignore.ghpages -Destination .gitignore

# Build wasm binary
cargo build --lib --target wasm32-unknown-unknown --release

# Reduce binary size
wasm-gc "./target/wasm32-unknown-unknown/release/customasm.wasm" -o "./target/wasm32-unknown-unknown/release/customasm.gc.wasm"

# Copy to web folder
Copy-Item -Path "./target/wasm32-unknown-unknown/release/customasm.gc.wasm" -Destination "./web/customasm.gc.wasm"

# Commit to git
git add -A
git commit -m "build GitHub Pages"
git push -f origin ghpages

# Return to main branch
git checkout main
2 changes: 1 addition & 1 deletion build_wasm.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build wasm binary
cargo +nightly build --lib --target wasm32-unknown-unknown --release
cargo build --lib --target wasm32-unknown-unknown --release

# Reduce binary size
wasm-gc "./target/wasm32-unknown-unknown/release/customasm.wasm" -o "./target/wasm32-unknown-unknown/release/customasm.gc.wasm"
Expand Down
Binary file removed web/customasm.gc.wasm
Binary file not shown.

0 comments on commit e9efbe4

Please sign in to comment.