Skip to content

Commit

Permalink
ci: setup GHA main workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ze-flo committed Jun 11, 2024
1 parent 0c3ee46 commit e8c3827
Showing 1 changed file with 150 additions and 0 deletions.
150 changes: 150 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: CI

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Build
run: npm exec -- lerna run build --concurrency=2

- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: packages/**/dist

build-demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Build Demo
run: npm run build:demo

- name: Upload demo artifacts
uses: actions/upload-artifact@v4
with:
name: demo-artifact
path: ./demo

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Lint
run: npm run lint:ci

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Test
run: npm run test:ci

- name: Coveralls
if: env.COVERALLS_REPO_TOKEN != ''
run: npm exec -- coveralls < .cache/coverage/lcov.info
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

deploy:
needs: [test, build-demo]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Download demo artifacts
uses: actions/download-artifact@v4
with:
name: demo-artifact
path: ./demo

- name: Deploy
run: utils/scripts/deploy.mjs
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

publish:
needs: [test, build]
runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Lerna needs full history for all branches and tags

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: packages

- name: Check dist button artifact
run: ls -Rla ./packages/buttons/dist

# - name: Publish to npm
# run: npm exec -- lerna publish from-git --ignore-scripts --yes
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit e8c3827

Please sign in to comment.