Skip to content

Publish to NPM

Publish to NPM #69

Workflow file for this run

name: Publish to NPM
on:
workflow_dispatch:
inputs:
package:
type: choice
description: Choose package to publish
options:
- graphql-mesh
- stryker-mutator
bump:
type: choice
description: Choose a bump type
options:
- patch
- minor
- major
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Setup Git
run: |
git config user.name "DiogoVCS"
git config user.email "diogovalensoares@gmail.com"
- name: Unshallow
run: git fetch --prune
- name: Install dependencies 🔧
run: npm install --frozen-lockfile
- name: Version
shell: bash
run: npx nx run ${{ github.event.inputs.package }}:version --releaseAs=${{ github.event.inputs.bump }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build 🔧
run: npx nx run ${{ github.event.inputs.package }}:build
- name: Find Tag
id: tagger
uses: jimschubert/query-tag-action@v1
with:
commit-ish: 'HEAD~'
skip-unshallow: 'true'
- name: Push new Tag
shell: bash
run: |
git push origin main --follow-tags --force
env:
TAG_NAME: ${{steps.tagger.outputs.tag}}
- name: Publish package on NPM 📦
run: npm publish ./dist/packages/${{ github.event.inputs.package }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}