Skip to content

Commit

Permalink
add GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
nygardk committed Nov 18, 2023
1 parent 7b38415 commit 01c82b3
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
Expand Down
15 changes: 15 additions & 0 deletions .github/actions/npm-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: npm install

description: Install NPM dependencies

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: 'npm'

- name: Install dependencies
shell: bash
run: npm ci
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "CI"

on:
pull_request:
branches:
- "**"

env:
FORCE_COLOR: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- run: npm run lint

check-types:
name: Check types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- run: npm run check-types

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- run: npm run build

27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
branches:
- master
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/npm-install

- name: Create Release PR or publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: npm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
"scripts": {
"build": "vite build",
"build-demo": "vite build --config vite.demo.config.js",
"check-types": "tsc --noEmit",
"demo": "vite --config vite.demo.config.js",
"lint": "eslint --ext .js,.jsx,.ts,.tsx ./src ./demo",
"prepublishOnly": "npm run build",
"start": "npm run run-demos"
"start": "npm run run-demos",
"release": "npm build && changeset publish"
},
"keywords": [
"react",
Expand Down

0 comments on commit 01c82b3

Please sign in to comment.