Skip to content

Instantly share code, notes, and snippets.

@shun-shobon
Created November 6, 2020 15:10
Show Gist options
  • Save shun-shobon/7b6b2559c0424cf7dcc2b10a7f9fcd9d to your computer and use it in GitHub Desktop.
Save shun-shobon/7b6b2559c0424cf7dcc2b10a7f9fcd9d to your computer and use it in GitHub Desktop.
GitHub Actionsのテンプレート
name: ci
on: push
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-
- run: yarn install --frozen-lockfile
- name: Run list
run: yarn lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-
- run: yarn install --frozen-lockfile
- name: Run test
run: yarn test:ci
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-
- run: yarn install --frozen-lockfile
- name: Run build
run: |
yarn clean
yarn build
- name: Upload dist
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment