refactor app and slightly improve interface #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: github-pages | |
on: | |
push: | |
branches: | |
- publish | |
page_build: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build project | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Ensure wasm-pack | |
# run: cargo install wasm-pack | |
uses: jetli/wasm-pack-action@v0.4.0 | |
- name: Print Rust version | |
run: | | |
cargo --version && | |
rustc --version && | |
wasm-pack --version | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create build directory | |
run: | | |
mkdir ./build ./build/assets | |
- name: Copy static files | |
run: | | |
find ./webconv/www/ -maxdepth 1 -type f \ | |
'(' -name '*.html' -o -name '*.js' ')' \ | |
-exec cp --verbose '{}' ./build ';' | |
- name: Compile | |
working-directory: ./webconv | |
run: | | |
wasm-pack build --target web | |
- name: Move Wasm package | |
run: | | |
mv ./webconv/pkg ./build/lib && | |
find ./build/lib/ -type f \ | |
'!' '(' -name '*.js' -o -name '*.wasm' ')' \ | |
-delete | |
- name: Get GitHub logo | |
run: | | |
wget https://github.githubassets.com/images/modules/logos_page/github-mark.zip && | |
unzip github-mark.zip github-mark/github-mark.svg && | |
mv ./github-mark/github-mark.svg -t ./build/assets/ || exit 0 | |
- name: Upload | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build | |
deploy: | |
name: Deploy to GitHub Pages | |
needs: [build] | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |