Skip to content

Create dependabot.yml (#5) #26

Create dependabot.yml (#5)

Create dependabot.yml (#5) #26

# 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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
workflow_dispatch:
push:
branches:
- "**"
pull_request:
branches:
- "main"
release:
types: [created]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: "yarn"
- run: yarn
- run: yarn build
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
test:
name: Test
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: "yarn"
- run: yarn
- run: yarn test
publish-npm:
if: github.event_name == 'release' && github.event.action == 'created'
name: Publish to NPM
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: "16.x"
registry-url: https://registry.npmjs.org
# Defaults to the user or organization that owns the workflow file
scope: "@dylanbulmer"
- run: yarn
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- run: |
TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
cd dist && yarn publish --access public --tag ${TAG:-latest}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_ACCESS_TOKEN}}