Skip to content

Commit

Permalink
ci: add ci & release actions files #166
Browse files Browse the repository at this point in the history
  • Loading branch information
woorim960 committed Oct 1, 2022
1 parent efce5a6 commit 0ceaa91
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ./github/workflows/ci.yml
# Excute lint and build.

name: CI

on:
push:
branches:
- develop
pull_request:
branches:
- develop

env:
NODE_VERSION: 16.x

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
id: node-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts

lint:
runs-on: ubuntu-latest
needs: [install, release]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Run linters
uses: wearerequired/lint-action@v1
with:
git_email: 'woorimprog@gmail.com'
auto_fix: true
commit_message: 'style: fix code style issues with ${linter}'
eslint: true
eslint_extensions: 'js,jsx,ts,tsx'
prettier: true
prettier_extensions: 'js,jsx,ts,tsx,css,html,scss'

build:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Build
run: npm run build

# test:
# runs-on: ubuntu-latest
# needs: [install]
# steps:
# - uses: actions/checkout@v2
# - uses: actions/cache@v2
# with:
# path: "**/node_modules"
# key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/package-lock.json') }}
# - name: Test
# run: npm test
47 changes: 47 additions & 0 deletions .github/workflows/release-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ./github/workflows/release-to-npm.yml
# Excute release to npm.

name: Release to NPM

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
NODE_VERSION: 16.x

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
id: node-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts

release:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

0 comments on commit 0ceaa91

Please sign in to comment.