Skip to content

πŸ”€ Merge pull request #11 from NMSCD/develop #14

πŸ”€ Merge pull request #11 from NMSCD/develop

πŸ”€ Merge pull request #11 from NMSCD/develop #14

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Build and Deploy
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
build:
environment: github-pages
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [19.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Setup Secrets
env:
ENV_ENABLE_SERVICEWORKER: ${{ secrets.ENV_ENABLE_SERVICEWORKER }}
ENV_ENABLE_ANALYTICS: ${{ secrets.ENV_ENABLE_ANALYTICS }}
run: |
touch .env
echo ENV_ENABLE_SERVICEWORKER="$ENV_ENABLE_SERVICEWORKER" >> .env
echo ENV_ENABLE_ANALYTICS="$ENV_ENABLE_ANALYTICS" >> .env
- name: Build HTML
run: |
npm ci
npm run build
- name: Edit .gitignore
run: |
echo "/github-pages-deploy-action-temp-deployment-folder" > ./public/.gitignore
- name: Add .nojekyll
run: |
cd public
touch .nojekyll
- name: Minify Code
uses: Lenni009/minify-js@main
with:
directory: public
overwrite: true
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: public # The folder the action should deploy.