Skip to content

add deploy

add deploy #41

name: Build and Deploy
on:
push:
branches:
- master
- feature/ci
pull_request:
branches:
- master
jobs:
# Build job
build:
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
# Checkout code
- uses: actions/checkout@v3
# Set up node
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
# Install, build and run project
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:ci
# - name: Test
# run: npm run test:ci
- name: Upload GitHub Pages artifact
if: success()
uses: actions/[email protected]
with:
path: dist/sudoku-app
deploy:
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
# - name: Cache node modules
# uses: actions/[email protected]
# env:
# cache-name: cache-node-modules
# with:
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ env.cache-name }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-
# - name: npm install and npm run CI commands
# run: |
# npm i
# npm run test:ci
# npm run build:ci