Skip to content

Workflow file for this run

name: Publish (NPM & GPR)
# publish only when package json has changed - assuming version upgrade
on:
push:
branches: [main]
paths: "packages/nextjs-themes/package.json"
jobs:
publish:
# Don't run just after creating repo from template
# Also avoid running after merging set-up PR
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
defaults:
run:
working-directory: ./packages/nextjs-themes
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org
node-version: 18
- run: npm i -g pnpm && pnpm i
name: Install dependencies
# fail and not publish if any of the unit tests are failing
- name: Test
run: pnpm test
- name: Update topics and Publish to NPM
run: pnpm build && pnpm publish-package && cd dist && node ../scope.js && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}
- uses: actions/setup-node@v3
with:
registry-url: https://npm.pkg.github.com/
- name: Publish to GitHub Public Repository
run: pnpm publish-package
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish lite version
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: node lite.js && pnpm build && pnpm publish-package && cd dist && node ../scope.js && sleep 2s && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.event.repository.owner.login }}
REPO: ${{ github.event.repository.name }}
- uses: actions/setup-node@v3
with:
registry-url: https://npm.pkg.github.com/
- name: Publish to GitHub Public Repository
run: pnpm publish-package
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}