Skip to content

Node.js Package

Node.js Package #19

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js Package
on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ '*.*.*' ]
release:
types: [created]
jobs:
build-and-test:
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_USER: tester
POSTGRES_PASSWORD: test-pwd
POSTGRES_DB: test-db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm run migrate
- run: npm run seed
- run: npm test
publish-npm:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}