Skip to content

43-update-to-latest-version-of-nx #2

43-update-to-latest-version-of-nx

43-update-to-latest-version-of-nx #2

Workflow file for this run

name: publish to npm
on:
push:
# main:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# We want to get the tag name without the @version suffix, this is our
# package name
- uses: actions/github-script@v6
id: get-tag-name
env:
GIT_TAG_NAME: ${{ github.ref_name }}
with:
result-encoding: string
script: return process.env.GIT_TAG_NAME.split('@')[0]
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
# - uses: nrwl/nx-set-shas@v3
# id: nx-toolkit-nx-set-shas
# with:
# workflow-id: 'publish firebase generator'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm nx run ${{ steps.get-tag-name.outputs.result }}:lint
- name: Test
run: pnpm nx run ${{ steps.get-tag-name.outputs.result }}:test
- name: Build
run: pnpm nx run ${{ steps.get-tag-name.outputs.result }}:build
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: dist/packages/${{ steps.get-tag-name.outputs.result }}/*.*
bodyFile: 'packages/${{ steps.get-tag-name.outputs.result }}/CHANGELOG.md'
- name: npm publish
run: npm publish dist/packages/${{ steps.get-tag-name.outputs.result }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}