Skip to content

Instantly share code, notes, and snippets.

@omega-takai
Created April 9, 2020 02:20
Show Gist options
  • Save omega-takai/3e9e947ce34c67baf503839610407384 to your computer and use it in GitHub Desktop.
Save omega-takai/3e9e947ce34c67baf503839610407384 to your computer and use it in GitHub Desktop.
GitHubActions
# Document: https://help.github.com/ja/actions
name: DEPLOYMENT
on:
push:
branches: [ master ]
jobs:
deploy:
name: GitHub Pages Deployment - Nuxt.js
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn generate:gh-pages
- name: deploy
if: success()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
# Document: https://help.github.com/ja/actions
name: CHECK BUILD
on: [pull_request]
jobs:
storybook:
name: Storybook can be generated
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [12.x]
steps:
- uses: actions/checkout@master
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- run: echo ${{ steps.yarn-cache.outputs.dir }}
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn build-storybook
- name: Show file size
uses: actions/upload-artifact@v1
with:
name: Storybook
path: .out
# Document: https://help.github.com/ja/actions
name: CI TEST
on: [push]
jobs:
lint:
name: Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [10.x, 12.x]
steps:
- uses: actions/checkout@master
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: yarn versions
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- run: echo ${{ steps.yarn-cache.outputs.dir }}
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: eslint
run: yarn lint
test:
name: Unit Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [10.x, 12.x]
steps:
- uses: actions/checkout@master
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: yarn versions
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- run: echo ${{ steps.yarn-cache.outputs.dir }}
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: jest
run: yarn test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment