74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
name: test and deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install wasm-pack
|
|
uses: jetli/wasm-pack-action@v0.3.0
|
|
|
|
- name: Build Rust for WASM
|
|
run: wasm-pack build
|
|
|
|
- name: Test WASM in-browser
|
|
run: wasm-pack test --firefox --chrome --headless
|
|
|
|
- name: Install Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install Node Modules
|
|
run: npm ci
|
|
working-directory: ./www
|
|
|
|
- name: Build Js
|
|
run: npm run build --if-present
|
|
working-directory: ./www
|
|
|
|
- name: Move CNAME file to Staging Directory
|
|
run: mv CNAME www/dist
|
|
|
|
- name: Deploy To Pages
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./www/dist
|
|
|
|
package:
|
|
|
|
runs-on: ubuntu-latest
|
|
needs: [build] # for ignoring bad builds
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build & Push Container
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: true
|
|
tags: sarsoo/game-of-life:latest
|