Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
name: Publish

on: registry_package
on:
registry_package:
workflow_dispatch:
inputs:
package:
description: 'Package dir name under @ecomplus/ (e.g. storefront-app)'
required: true
type: string

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
env:
PKG_OWNER: ${{ github.event.registry_package.owner.login }}
PKG_NAME: ${{ github.event.registry_package.name }}
PKG_OWNER: ${{ github.event.registry_package.owner.login || 'ecomplus' }}
PKG_NAME: ${{ github.event.registry_package.name || inputs.package }}
# setup-node writes `.npmrc` with `${NODE_AUTH_TOKEN}` and, since v7, no
# longer exports a placeholder: npm 6 aborts `npm i` when the var is unset
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- name: Checkout
Expand All @@ -24,7 +34,9 @@ jobs:
run: npm i

- name: Build package
run: npx lerna run --scope=@$PKG_OWNER/$PKG_NAME build
# explicit local bin: without node_modules `npx lerna` falls back to the
# runner's global (latest) lerna, which needs Node 18+ and crashes on Node 14
run: ./node_modules/.bin/lerna run --scope=@$PKG_OWNER/$PKG_NAME build

- name: Edit package.json and publish to npm registry
env:
Expand All @@ -37,7 +49,7 @@ jobs:
npm publish --access public

- name: Trigger Netlify deploy
if: github.event.registry_package.name == 'storefront-template'
if: env.PKG_NAME == 'storefront-template'
env:
NETLIFY_HOOK_ENDPOINT: ${{ secrets.NETLIFY_HOOK_ENDPOINT }}
run: |
Expand Down
Loading