Skip to content

Localized component (#26) #166

Localized component (#26)

Localized component (#26) #166

name: back-kit-engine CI
env:
context: ./
cache-name: cache-build
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
on:
push:
branches: [ main ]
tags: ['*']
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16.x
- 17.x
steps:
- 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 config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: microsoft/playwright-github-action@v1
- run: npx playwright install-deps
- run: yarn install --immutable
- run: yarn coverage:ci
- name: Coveralls
uses: coverallsapp/github-action@master
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: '${{ env.context }}coverage/lcov.info'
base-path: '${{ env.context }}'
- name: Compile file and build
if: ${{ (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.base_ref == 'main') && matrix.node-version == '16.x' }}
run: yarn build
- name: Cache dist directory
uses: actions/cache@v3
id: dist-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ env.context }}dist
key: ${{ runner.os }}-dist-${{ github.sha }}
release:
needs: ['test']
if: ${{ (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
always-auth: true
registry-url: 'https://registry.npmjs.org'
scope: '@micro-lc'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache Pull
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Pull
uses: actions/cache@v3
with:
path: |
${{ env.context }}dist
key: ${{ runner.os }}-dist-${{ github.sha }}
- run: yarn install --immutable
- run: yarn npm publish