Skip to content

Workflow file for this run

name: Publish Package to npmjs
on:
release:
types: [published]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 19.x
- name: Start Redis
uses: supercharge/redis-github-action@1.5.0
with:
redis-version: 7
redis-port: 6379
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Formatting
run: yarn format
- name: Linting
run: yarn lint
- name: Build
run: yarn build
- name: Run tests
run: yarn test
publish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn build
- uses: JS-DevTools/npm-publish@v3
id: publish
with:
token: ${{ secrets.NPM_TOKEN }}
- if: ${{ steps.publish.outputs.type }}
run: echo "$PCKG_ID published to $PCKG_TAG, old version was [$OLD_VER]"
env:
OLD_VER: ${{ steps.publish.outputs.old-version }}
PCKG_ID: ${{ steps.publish.outputs.id }}
PCKG_TAG: ${{ steps.publish.outputs.tag }}