-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
183 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: CI | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/v1' }} | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- v1 | ||
|
||
jobs: | ||
setup: | ||
name: Setup | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Load current commit | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- name: Setup Node.js | ||
uses: volta-cli/action@v4 | ||
|
||
- name: Restore cache | ||
uses: actions/cache@v3 | ||
id: yarn-cache | ||
if: github.event_name == 'pull_request' || github.event_name == 'push' | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
|
||
- name: Install dependencies | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: | | ||
yarn --frozen-lockfile --no-progress | ||
static-checks: | ||
name: Static checks | ||
needs: setup | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Load current commit | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- name: Setup Node.js | ||
uses: volta-cli/action@v4 | ||
|
||
- name: Restore cache | ||
uses: actions/cache@v3 | ||
id: yarn-cache | ||
if: github.event_name == 'pull_request' || github.event_name == 'push' | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
|
||
- name: Install dependencies | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: | | ||
yarn --frozen-lockfile --no-progress | ||
- name: Prettier check | ||
run: yarn prettier:check | ||
|
||
- name: Linter | ||
run: yarn lint | ||
|
||
- name: Type check | ||
run: yarn typecheck | ||
|
||
tests: | ||
name: Unit tests | ||
needs: setup | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Load current commit | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- name: Setup Node.js | ||
uses: volta-cli/action@v4 | ||
|
||
- name: Restore cache | ||
uses: actions/cache@v3 | ||
id: yarn-cache | ||
if: github.event_name == 'pull_request' || github.event_name == 'push' | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
|
||
- name: Install dependencies | ||
if: steps.yarn-cache.outputs.cache-hit != 'true' | ||
run: | | ||
yarn --frozen-lockfile --no-progress | ||
- name: Run unit tests | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Publish package | ||
|
||
on: | ||
push: | ||
tags: | ||
- v1.*.* | ||
|
||
jobs: | ||
publish-to-npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://registry.npmjs.org' | ||
scope: ${{ github.repository_owner }} | ||
|
||
- name: Update package.json | ||
run: | | ||
TAG_NAME=${GITHUB_REF/refs\/tags\//} | ||
PACKAGE_VERSION=${TAG_NAME#v} | ||
echo "Updating package.json to version $PACKAGE_VERSION" | ||
cat <<< $(jq -r ".version=\"$PACKAGE_VERSION\"" package.json) > package.json | ||
cat package.json | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Publish | ||
run: yarn publish | ||
working-directory: dist | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
publish-to-github: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: ${{ github.repository_owner }} | ||
|
||
- name: Update package.json | ||
run: | | ||
TAG_NAME=${GITHUB_REF/refs\/tags\//} | ||
PACKAGE_VERSION=${TAG_NAME#v} | ||
echo "Updating package.json to version $PACKAGE_VERSION" | ||
cat <<< $(jq -r ".version=\"$PACKAGE_VERSION\"" package.json) > package.json | ||
cat package.json | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Publish | ||
run: yarn publish | ||
working-directory: dist | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters