Skip to content

Commit 85029c2

Browse files
author
James Amner
authored
Merge pull request #361 from boxuk/BWP-105
[J#BWP-105] Add publish to NPM action
2 parents 321153b + ce5d0bc commit 85029c2

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

.github/workflows/packages.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ jobs:
4343
- name: Setup Node
4444
uses: actions/setup-node@v4
4545
with:
46-
node-version: "20"
46+
node-version-file: .nvmrc
47+
cache: npm
4748
- name: Install Dependencies
4849
run: npm install
4950
- name: Build Packages

.github/workflows/publish-npm.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Publish to NPM"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "*"
9+
10+
jobs:
11+
packages_split:
12+
runs-on: ubuntu-latest
13+
name: "Publish changes to ${{ matrix.packages.target_repo }}"
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
packages:
18+
- local_path: "feature-flags"
19+
target: "@boxuk/wp-feature-flags"
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
token: ${{ secrets.BOXUK_WP_ROBOT_ACCESS_TOKEN }}
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
registry-url: "https://registry.npmjs.org/"
29+
- name: Publish to NPM
30+
working-directory: packages/${{ matrix.packages.local_path }}
31+
run: npm publish --access public
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.SYSENG_NPMJS_PUBLISHING_TOKEN }}
34+
35+

.nvmrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
22
1+
22
2+
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
3+
registry=https://registry.npmjs.org/
4+
always-auth=true

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ parameters:
1212
- /**/node_modules/*
1313
analyseAndScan:
1414
- packages/vendor/10up/wp_mock # WP_Mock functions override the signatures from php-stubs/wordpress
15+
- packages/vendor/**/tests/**/*.php # Theres functions that overrule

0 commit comments

Comments
 (0)