Skip to content

Refactor CLI.js to improve user experience and add project running op… #14

Refactor CLI.js to improve user experience and add project running op…

Refactor CLI.js to improve user experience and add project running op… #14

Workflow file for this run

name: Publish npm package
on: push
env:
NPM_TOKEN: ${{secrets.GH_PRIVATE_NPM_TOKEN}}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout source code"
uses: actions/checkout@v3
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: "Install pnpm"
run: npm install -g pnpm
- name: "Check build"
run: pnpm install
bump-version:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: "Checkout source code"
uses: actions/checkout@v3
- name: "cat package.json (before bump)"
run: cat ./package.json
- name: "Automated Version Bump"
id: version-bump
uses: "phips28/gh-action-bump-version@master"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "cat package.json (after bump)"
run: cat ./package.json
- name: "Output New Version"
env:
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
run: echo "new tag $NEW_TAG"
publish-gpr:
needs: bump-version
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: "Checkout source code"
uses: actions/checkout@v3
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: "Install pnpm"
run: |
npm install -g pnpm
pnpm setup
env:
SHELL: bash
- name: "Install can-npm-publish"
run: |
pnpm add can-npm-publish --save-dev
- name: Setup .npmrc file to authenticate with npm
run: |
echo "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}" > .npmrc
- name: "Git status check"
run: git status
- name: "Publish package if needed"
run: npx can-npm-publish --verbose && pnpm publish --no-git-checks || echo "Does not publish"