Skip to content

modify previous change: comment-out instead of deleting #397

modify previous change: comment-out instead of deleting

modify previous change: comment-out instead of deleting #397

Workflow file for this run

###
# The MIT License
# Copyright (c) 2021 David Wheatley
# Copyright (c) 2021 Kishan Singh
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
###
# Lints and checks the websites, and then deploys it if branch is main
# From https://github.com/davwheat/world-cup-of-tocs/blob/master/.github/workflows/smoketest.yml
name: Website Builder
on:
push:
branches:
- "main"
- "isitweeka-as-a-service"
pull_request:
env:
# Because I use windows, yarn.lock is different to CI builds
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jobs:
install:
runs-on: ubuntu-latest
name: Prepare repo
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - name: Restore dependencies cache
# uses: actions/cache@v2
# id: yarn-cache
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
# - name: Install dependencies on cache miss
# run: yarn install --frozen-lockfile
# if: steps.yarn-cache.outputs.cache-hit != 'true'
# working-directory: ./frontend
# - name: Install project dependencies from cache
# run: yarn --prefer-offline --frozen-lockfile
# if: steps.yarn-cache.outputs.cache-hit == 'true'
# working-directory: ./frontend
- name: Yarn version
run: yarn set version ./.yarn/releases/yarn-3.2.0.cjs
- name: Install dependencies
run: yarn install
- name: Cache node_modules for other runs
uses: actions/cache@v2
id: module-cache
with:
path: ./frontend/node_modules
key: ${{ runner.os }}-node-modules-${{ github.sha }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-${{ github.sha }}-
lint:
runs-on: ubuntu-latest
needs: [install]
name: Lint
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# - name: Restore dependencies cache
# uses: actions/cache@v2
# id: moduleCache
# with:
# path: ./frontend/node_modules
# key: ${{ runner.os }}-node-modules-${{ github.sha }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-node-modules-${{ github.sha }}-
- name: Yarn version
run: yarn set version ./.yarn/releases/yarn-3.2.0.cjs
- name: Install dependencies
run: yarn install
- name: Lint using ESLint
run: yarn lint
working-directory: ./frontend
# TODO: Enable when needed
# formatting:
# runs-on: ubuntu-latest
# needs: [install]
# name: Verify formatting
# strategy:
# matrix:
# node-version: [14.x]
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - name: Restore dependencies cache
# uses: actions/cache@v2
# id: moduleCache
# with:
# path: ./frontend/node_modules
# key: ${{ runner.os }}-node-modules-${{ github.sha }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-node-modules-${{ github.sha }}-
# - name: Verify formatting
# run: yarn format:check
# working-directory: ./frontend/node_modules
build:
runs-on: ubuntu-latest
# needs: [lint, formatting]
needs: [install]
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# - name: Restore dependencies cache
# uses: actions/cache@v2
# id: moduleCache
# with:
# path: ./frontend/node_modules
# key: ${{ runner.os }}-node-modules-${{ github.sha }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-node-modules-${{ github.sha }}-
- name: Yarn version
run: yarn set version ./.yarn/releases/yarn-3.2.0.cjs
- name: Install dependencies
run: yarn install
- name: Build site
run: yarn build
working-directory: ./frontend
env:
CI: false # Otherwise warnings fail the build
- name: Upload a compiled website
uses: actions/upload-artifact@v2
with:
name: Compiled website
path: frontend/build/
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/[email protected]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: frontend/build
CLEAN: true