Skip to content

feat(CssToAndFromReact): Minor fixes #302

feat(CssToAndFromReact): Minor fixes

feat(CssToAndFromReact): Minor fixes #302

Workflow file for this run

# This workflow will do a clean install of node dependencies, 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: Node.js CI
on:
push:
branches: [ master ]
pull_request:
types: [opened, synchronize]
# branches: [ master ]
jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
NODE_ACTIVE_LTS_VERSION: 20.x
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
# uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# reference: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-react-and-next
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
# reference: https://nextjs.org/docs/messages/no-cache#github-actions
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.yarn-cache.outputs.dir }}
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-nextjs-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-nextjs-
# reference: https://stackoverflow.com/a/58525708
- run: yarn install --frozen-lockfile
- run: yarn test
env:
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ENABLED: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ENABLED }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_GA_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_GA_MEASUREMENT_ID }}
- name: Build (only for the active node version)
run: yarn build
env:
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ENABLED: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ENABLED }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_TRACKING_ID }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_GA_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_GA_MEASUREMENT_ID }}
if: ${{ matrix.node-version == env.NODE_ACTIVE_LTS_VERSION }}
- name: Prepare tag
id: prepare_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "::set-output name=tag_name::${TAG_NAME}"
echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"
- name: Deploy (if merging to `master`)
# reference: https://kevsoft.net/2020/06/10/running-github-action-steps-and-jobs-only-on-push-to-master.html
if: ${{ matrix.node-version == env.NODE_ACTIVE_LTS_VERSION && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
# reference: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-create-git-tag
tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
# - run: npm ci
# - run: npm run build --if-present
# - run: npm test