github actions GOO #2
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: Build and Deploy | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: rust-toolchain | |
uses: actions-rs/[email protected] | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install wasm-pack | |
uses: jetli/[email protected] | |
with: | |
version: "latest" | |
- name: Build WASM | |
run: wasm-pack build --target web | |
working-directory: ./nbody_simulator | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./web | |
- name: Build Tailwind CSS | |
run: npx tailwindcss -i ./src/app.css -o ./src/tailwind.css --minify | |
working-directory: ./web | |
- name: Prepare dist directory | |
run: | | |
mkdir -p dist/web/src | |
mkdir -p dist/nbody_simulator/pkg | |
cp -R ./web/src/ dist/ | |
cp -R ./nbody_simulator/pkg dist/nbody_simulator/pkg | |
shell: bash | |
- name: Install Netlify | |
run: npm i [email protected] -g | |
- name: Deploy to Netlify | |
id: netlify_deploy | |
run: | | |
netlify deploy \ | |
--dir dist \ | |
--site ${{ secrets.NETLIFY_SITE_ID }} \ | |
--auth ${{ secrets.NETLIFY_API_TOKEN }} |