choer: create nuxtjs.yml #38
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: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
with: | |
# Automatically inject router.base in your Nuxt configuration file and set | |
# target to static (https://nuxtjs.org/docs/configuration-glossary/configuration-target/). | |
# | |
# You may remove this line if you want to manage the configuration yourself. | |
static_site_generator: nuxt | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
~/node_modules | |
~/.pnpm-store | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Install pnpm | |
run: | | |
npm install -g pnpm@8.1.1 | |
- name: Install wasm-pack | |
run: | | |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build Rust Wasm module | |
run: | | |
cargo build --release | |
cd ./crates/rmonkey_wasm | |
wasm-pack build | |
- name: Install dependencies | |
run: | | |
pnpm install --frozen-lockfile | |
- name: Build Nuxt app | |
env: | |
NUXT_ENV_TARGET_DIR: dist | |
run: | | |
pnpm run generate | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./dist | |
deploy: | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |