2021-06-21 22:41:48 +01:00
|
|
|
name: test and deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
2024-07-22 19:27:46 +01:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2021-06-21 22:41:48 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-06-22 21:05:22 +01:00
|
|
|
- name: Test WASM in-browser
|
|
|
|
run: wasm-pack test --firefox --chrome --headless
|
2021-06-21 22:41:48 +01:00
|
|
|
|
|
|
|
- name: Install Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2022-05-05 23:11:32 +01:00
|
|
|
node-version: 18
|
2021-06-21 22:41:48 +01:00
|
|
|
|
|
|
|
- name: Install Node Modules
|
|
|
|
run: npm ci
|
2021-06-21 22:46:38 +01:00
|
|
|
working-directory: ./www
|
2021-06-21 22:41:48 +01:00
|
|
|
|
|
|
|
- name: Build Js
|
|
|
|
run: npm run build --if-present
|
2021-06-21 22:46:38 +01:00
|
|
|
working-directory: ./www
|
2021-06-21 22:41:48 +01:00
|
|
|
|
2022-05-05 23:11:32 +01:00
|
|
|
- name: Move CNAME file to Staging Directory
|
|
|
|
run: mv CNAME www/dist
|
|
|
|
|
2021-06-21 22:41:48 +01:00
|
|
|
- name: Deploy To Pages
|
2024-07-22 19:27:46 +01:00
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
2021-06-21 22:41:48 +01:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-06-21 22:46:38 +01:00
|
|
|
publish_dir: ./www/dist
|
2023-05-16 17:47:50 +01:00
|
|
|
|
|
|
|
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 }}
|
|
|
|
|
2023-05-16 18:22:14 +01:00
|
|
|
- name: Build & Push Container
|
2023-05-16 17:47:50 +01:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
tags: sarsoo/game-of-life:latest
|