Skip to content

Commit e931b4a

Browse files
committed
Update github actions - add new script
1 parent 2e0512c commit e931b4a

File tree

7 files changed

+291
-6
lines changed

7 files changed

+291
-6
lines changed

.github/workflows/on-merge-main-deploy-gpr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
node-version: "16.x"
2121
registry-url: "https://npm.pkg.github.com"
2222
- run: npm ci
23-
- run: npm run npm-build-package
23+
- run: npm run npm-build-package:npmjs
2424
- run: cd dist/npm && npm publish --access public
2525
env:
2626
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on-merge-main-deploy-npmjs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ jobs:
1717
registry-url: "https://registry.npmjs.org"
1818
scope: "@proangular"
1919
- run: npm ci
20-
- run: npm run npm-build-package
21-
- run: rm /dist/npm/.npmrc
20+
- run: npm run npm-build-package:gpr
2221
- run: cd dist/npm && npm publish
2322
env:
2423
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

.github/workflows/verify-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
- name: Build 🔧
1717
run: |
1818
npm run build:prod
19-
npm run npm-build-package
19+
npm run npm-build-package:npmjs

.scripts/prepare-gpr.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { readFileSync, writeFileSync } from 'fs-extra';
2+
3+
const packagePath = __dirname + '/../dist/npm/package.json';
4+
5+
// Update `package.json` to prepare publishing the package to GitHub
6+
try {
7+
console.log('patching', packagePath);
8+
const packageContent = JSON.parse(readFileSync(packagePath, 'utf8'));
9+
writeFileSync(
10+
packagePath,
11+
JSON.stringify({
12+
...packageContent,
13+
publishConfig: {
14+
registry: 'https://npm.pkg.github.com',
15+
},
16+
}),
17+
);
18+
} catch (error: unknown) {
19+
throw new Error(
20+
`Failed to update package JSON at path "${packagePath}" resulting in the following error: ${String(
21+
error,
22+
)}`,
23+
);
24+
} finally {
25+
console.log('Package ready for GPR.');
26+
}

.scripts/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"target": "es2021",
6+
"lib": ["es2021"],
7+
"types": ["node"]
8+
}
9+
}

0 commit comments

Comments
 (0)