mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
129 lines
3.7 KiB
YAML
129 lines
3.7 KiB
YAML
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore: ['**/README.md']
|
|
pull_request:
|
|
branches: [main]
|
|
types: [opened, synchronize]
|
|
paths-ignore: ['**/README.md']
|
|
|
|
jobs:
|
|
avoid_reduncy:
|
|
runs-on: ubuntu-20.04
|
|
if: ${{ github.event_name == 'push' }}
|
|
steps:
|
|
- name: Cancel Previous Redundant Builds
|
|
uses: styfle/cancel-workflow-action@0.9.1
|
|
with:
|
|
access_token: ${{ github.token }}
|
|
|
|
lint:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: 'yarn'
|
|
node-version: '16'
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- name: Lint
|
|
run: yarn lint
|
|
|
|
build:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: 'yarn'
|
|
node-version: '16'
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: ${{ github.workspace }}/.next/cache
|
|
# Generate a new cache whenever packages or source files change.
|
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
|
# If source files changed but packages didn't, rebuild from a prior cache.
|
|
restore-keys: |
|
|
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
|
|
- name: Build
|
|
run: yarn build
|
|
|
|
tests:
|
|
needs: [lint, build]
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: 'yarn'
|
|
node-version: '16'
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- name: Test
|
|
run: yarn coverage:update
|
|
- uses: codecov/codecov-action@v2
|
|
with:
|
|
directory: './packages/react'
|
|
|
|
publish:
|
|
needs: [build, tests]
|
|
runs-on: ubuntu-20.04
|
|
if: ${{ github.event_name == 'push' }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: 'yarn'
|
|
node-version: '16'
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- name: Pre puiblish NextUI package
|
|
run: yarn pre-publish:nextui
|
|
- uses: JS-DevTools/npm-publish@v1
|
|
with:
|
|
token: ${{ secrets.NPM_TOKEN }}
|
|
package: './packages/react/lib/package.json'
|
|
- name: Show published version
|
|
if: steps.publish.outputs.type != 'none'
|
|
run: |
|
|
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
|
|
- name: Tag new version
|
|
if: steps.publish.outputs.type != 'none'
|
|
uses: Klemensas/action-autotag@stable
|
|
with:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
tag_prefix: "v"
|
|
package_root: "./packages/react"
|
|
|
|
update_algolia_index:
|
|
needs: [publish]
|
|
runs-on: ubuntu-20.04
|
|
if: ${{ github.event_name == 'push' }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
cache: 'yarn'
|
|
node-version: '16'
|
|
- name: Install dependencies
|
|
run: yarn install --frozen-lockfile
|
|
- name: Upload docs on Algolia
|
|
run: yarn build:docs-meta
|
|
env:
|
|
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
|
|
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
|
|
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
|