Skip to content

Commit

Permalink
add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
morewings committed May 12, 2024
1 parent 0d88e21 commit 2eb7e48
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/merge-jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Post-merge tasks

on:
push:
branches: [ master ]

jobs:
build-publish:

runs-on: ubuntu-latest

steps:
- name: Cancel Workflow Action
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v4

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run merge tasks
run: |
pnpm install
# - name: Publish NPM package
# uses: JS-DevTools/npm-publish@v3
# with:
# token: ${{ secrets.NPM_TOKEN }}
58 changes: 58 additions & 0 deletions .github/workflows/pull-request-jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
pull_request:
branches: [ master ]

jobs:
lint-test:

runs-on: ubuntu-latest

steps:
- name: Cancel Workflow Action
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v4

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run test tasks
run: |
pnpm install
pnpm run lint:code --quiet
pnpm run lint:style --quiet
pnpm run lint:tsc
pnpm run build
pnpm run test --silent

0 comments on commit 2eb7e48

Please sign in to comment.