34 lines
954 B
YAML
34 lines
954 B
YAML
name: Build and Publish
|
|
on: [push, pull_request]
|
|
jobs:
|
|
build_and_publish:
|
|
name: Build and Publish (on release)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: 🛎️ Checkout
|
|
uses: actions/checkout@v2
|
|
- name: 🛠️ Configure Registry
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16.x'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
- name: 📦 Install Dependencies
|
|
run: npm ci
|
|
- name: 🧾 Test
|
|
run: npm test
|
|
- name: 🔥 Build Package
|
|
run: npm pack
|
|
- name: 💾 Archive Package built
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: package
|
|
path: '*.tgz'
|
|
- name: 🚀 Publish Package
|
|
run: npm publish --access public
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|