Skip to content

Commit c5ce4c6

Browse files
committed
Support installing private packages
1 parent 90fad68 commit c5ce4c6

File tree

12 files changed

+51
-7
lines changed

12 files changed

+51
-7
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ RUN mkdir -p .config/git \
99
&& echo ".vscode/*" >> .config/git/ignore \
1010
&& echo "*.code-workspace" >> .config/git/ignore \
1111
&& echo ".history/" >> .config/git/ignore
12+
13+
RUN echo '//npm.pkg.github.com/:_authToken=${GH_TOKEN}' > .npmrc

.github/actions/setup/action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ name: Setup
33
description: Setup Node.js and install dependencies.
44

55
inputs:
6+
node_auth_token:
7+
description: The Node.js auth token.
8+
required: true
69
node_version:
710
description: The Node.js version.
811
required: false
912
default: '18'
1013
registry_url:
1114
description: The Node.js package registry URL.
1215
required: false
13-
default: https://registry.npmjs.org
16+
default: https://npm.pkg.github.com
1417
install_dependencies:
1518
description: Install dependencies.
1619
required: false
@@ -35,4 +38,15 @@ runs:
3538
- name: Install dependencies
3639
if: inputs.install_dependencies == 'true'
3740
shell: bash
38-
run: npm ci
41+
run: npm ci --ignore-scripts
42+
env:
43+
NODE_AUTH_TOKEN: ${{ inputs.node_auth_token }}
44+
- name: Rebuild Node.js modules
45+
shell: bash
46+
run: npm rebuild
47+
- name: Run postinstall script
48+
shell: bash
49+
run: npm run postinstall --if-present
50+
- name: Run prepare script
51+
shell: bash
52+
run: npm run prepare --if-present

.github/workflows/_build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
uses: ./.github/actions/setup
2727
with:
2828
node_version: ${{ inputs.node_version }}
29+
node_auth_token: ${{ secrets.GH_TOKEN }}
2930
- name: Build
3031
run: npm run build
3132
- name: Package

.github/workflows/_publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
uses: ./.github/actions/setup
3030
with:
3131
install_dependencies: 'false'
32+
node_auth_token: ${{ secrets.GH_TOKEN }}
3233
- name: Download artifact
3334
uses: actions/download-artifact@v3
3435
with:

.github/workflows/check.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
uses: ./.github/actions/setup
3636
with:
3737
node_version: ${{ matrix.node }}
38+
node_auth_token: ${{ secrets.GH_TOKEN }}
3839
- name: Test
3940
run: npm test
4041
lint:
@@ -54,6 +55,7 @@ jobs:
5455
uses: ./.github/actions/setup
5556
with:
5657
node_version: ${{ matrix.node }}
58+
node_auth_token: ${{ secrets.GH_TOKEN }}
5759
- name: Lint
5860
run: npm run lint
5961
build:
@@ -111,7 +113,18 @@ jobs:
111113
contents: |
112114
import '@seamapi/makenew-tsmodule'
113115
- name: Install
114-
run: npm install --save ${{ steps.packages.outputs.paths }}
116+
run: npm install --ignore-scripts --save ${{ steps.packages.outputs.paths }}
117+
env:
118+
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
119+
- name: Rebuild Node.js modules
120+
shell: bash
121+
run: npm rebuild
122+
- name: Run postinstall script
123+
shell: bash
124+
run: npm run postinstall --if-present
125+
- name: Run prepare script
126+
shell: bash
127+
run: npm run prepare --if-present
115128
- name: Run
116129
run: node index.js
117130
typecheck:
@@ -131,5 +144,6 @@ jobs:
131144
uses: ./.github/actions/setup
132145
with:
133146
node_version: ${{ matrix.node }}
147+
node_auth_token: ${{ secrets.GH_TOKEN }}
134148
- name: Typecheck
135149
run: npm run typecheck

.github/workflows/format.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
passphrase: ${{ secrets.GPG_PASSPHRASE }}
3030
- name: Setup
3131
uses: ./.github/actions/setup
32+
with:
33+
node_auth_token: ${{ secrets.GH_TOKEN }}
3234
- name: Format
3335
run: npm run format
3436
- name: Commit

.github/workflows/generate.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ jobs:
3232
with:
3333
install_dependencies: 'false'
3434
- name: Normalize package-lock.json
35-
run: npm install
35+
run: npm install --ignore-scripts
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
3638
- name: Commit
3739
uses: stefanzweifel/git-auto-commit-action@v4
3840
with:

.github/workflows/version.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ jobs:
3131
passphrase: ${{ secrets.GPG_PASSPHRASE }}
3232
- name: Setup
3333
uses: ./.github/actions/setup
34+
with:
35+
node_auth_token: ${{ secrets.GH_TOKEN }}
3436
- name: Cut ${{ github.event.inputs.version }} version
3537
run: npm version --sign-git-tag=true ${{ github.event.inputs.version }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package
2222
.tern-port
2323

2424
# npm config
25-
.npmrc
25+
# .npmrc
2626

2727
# Temporary development files
2828
tmp

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@seamapi:registry=https://npm.pkg.github.com

0 commit comments

Comments
 (0)