▌▌▖▖▌▘▌▌▌▘▘▌▌▘▖▌▌▌▘▖▌▘▖▘ #34
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: WASM Build and Deploy | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build WASM | |
run: | | |
wasm-pack build wasm --target web | |
ls -la wasm/pkg/ | |
- name: Prepare deployment | |
run: | | |
# Create necessary directories | |
mkdir -p docs/pkg docs/assets | |
# Create .nojekyll | |
touch docs/.nojekyll | |
# Copy WASM files | |
cp wasm/pkg/dollcode_wasm_bg.wasm docs/pkg/ | |
cp wasm/pkg/dollcode_wasm.js docs/pkg/ | |
# List all copied files | |
echo "Contents of docs:" | |
ls -la docs | |
echo "Contents of docs/pkg:" | |
ls -la docs/pkg | |
echo "Contents of docs/assets:" | |
ls -la docs/assets | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: docs | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |