Skip to content

Commit

Permalink
feat: automatic pipeline through github actions
Browse files Browse the repository at this point in the history
Ref: GH-10
  • Loading branch information
georgeflug committed Oct 22, 2022
1 parent e7fb2b1 commit 350d39c
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, 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: Build and Publish

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [16.x, 18.x]

steps:
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3

# https://github.com/marketplace/actions/setup-node-js-environment
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test

publish:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref_name == 'main' }}

steps:
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# https://github.com/marketplace/actions/setup-node-js-environment
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- run: npm run build
- run: npm run release -- --npm.skipChecks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 350d39c

Please sign in to comment.