nginxconfig.io/.github/workflows/gh-pages-workflow.yml
Matt Cowley f44832ed7a
Update workflows with v3 actions + permissions (#404)
* Update Spaces workflow

* Update Pages workflow

* Update test workflow
2022-11-11 01:28:02 +00:00

55 lines
1.2 KiB
YAML

name: Test and deploy to GitHub Pages
on:
push:
branches:
- master
permissions:
contents: write
concurrency:
group: gh-pages-workflow
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: Setup NPM
run: |
NPM_VERSION=$(jq -r .engines.npm package.json)
NPM_VERSION=${NPM_VERSION/\^/}
if [ "$(npm --version)" != "$NPM_VERSION" ]; then
npm install -g npm@$NPM_VERSION && npm --version
else
echo "NPM version is same as package.json engines.npm"
fi
- name: Install dependencies
run: npm ci
- name: Test before production
run: npm test
- name: Build tool
run: npm run build
env:
NODE_ENV: production
- name: Deploy master to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
clean: true
single-commit: true