Skip to content

Commit 7bd9320

Browse files
committed
Revert "chore(publish): remove GH Packages intermediary, publish directly to npm"
This reverts commit ecdc513.
1 parent ecdc513 commit 7bd9320

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish
2+
3+
on: registry_package
4+
5+
jobs:
6+
publish:
7+
name: Publish to npm
8+
runs-on: ubuntu-latest
9+
env:
10+
PKG_OWNER: ${{ github.event.registry_package.owner.login }}
11+
PKG_NAME: ${{ github.event.registry_package.name }}
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v6
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v6
19+
with:
20+
node-version: '14.x'
21+
registry-url: 'https://registry.npmjs.org/'
22+
23+
- name: Install dependencies
24+
run: npm i
25+
26+
- name: Build package
27+
run: npx lerna run --scope=@$PKG_OWNER/$PKG_NAME build
28+
29+
- name: Edit package.json and publish to npm registry
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
run: |
33+
cd ./@$PKG_OWNER/$PKG_NAME && \
34+
node -p "const pkg = require('./package.json'); \
35+
if (pkg.publishConfig) delete pkg.publishConfig.registry; \
36+
JSON.stringify(pkg, null, 2)" > pkg.json && mv pkg.json package.json && \
37+
npm publish --access public
38+
39+
- name: Trigger Netlify deploy
40+
if: github.event.registry_package.name == 'storefront-template'
41+
env:
42+
NETLIFY_HOOK_ENDPOINT: ${{ secrets.NETLIFY_HOOK_ENDPOINT }}
43+
run: |
44+
sleep 30
45+
curl -X POST -d {} $NETLIFY_HOOK_ENDPOINT

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"message": "chore(release): publish :tada: [skip ci]"
1717
},
1818
"publish": {
19-
"registry": "https://registry.npmjs.org"
19+
"registry": "https://npm.pkg.github.com"
2020
}
2121
},
2222
"ignoreChanges": [

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
"build:demo": "npm run run:main -- build:site",
1616
"preversion": "lerna run build --since",
1717
"version": "GH_TOKEN=$(grep GH_TOKEN .env | cut -d '=' -f2) lerna version",
18-
"publish": "npx lerna run build --ignore @ecomplus/storefront-framework --ignore @ecomplus/storefront-renderer --ignore @ecomplus/storefront-template --ignore @ecomplus/storefront-starter && npx lerna publish from-package --yes",
19-
"release": "npm run version && npm run release:starter",
18+
"release": "npm run version && lerna publish from-git && npm run release:starter",
2019
"release:starter": "node ./scripts/release-starter.js",
21-
"release:all": "npm run version -- --force-publish",
20+
"release:all": "npm run version -- --force-publish && lerna publish from-git",
2221
"docs:dev": "vuepress dev",
2322
"docs:build": "vuepress build",
2423
"themes:build": "node ./scripts/build-themes.js"

0 commit comments

Comments
 (0)