iamolegga/nestjs-roles

View on GitHub
.github/workflows/publish-with-git-tag-version.yml

Summary

Maintainability
Test Coverage
name: publish-with-git-tag-version

on:
  workflow_call:

jobs:
  publish-with-git-tag-version:
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - uses: actions/setup-node@v3
        with:
          node-version: 20
          registry-url: 'https://registry.npmjs.org'

      - run: npm ci

      - run: npm version --no-git-tag-version $(git describe --abbrev=0 --tags)

      - run: |
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          git commit -m "update version" -a

      - uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}