-
Notifications
You must be signed in to change notification settings - Fork 97
79 lines (70 loc) · 2.17 KB
/
npm-publish.yml
File metadata and controls
79 lines (70 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Publish to npm
on:
workflow_dispatch:
inputs:
dry_run:
type: boolean
default: true
description: 'Dry-run (test without publishing)'
tag:
type: choice
default: 'latest'
options:
- latest
- next
description: 'npm tag (use "next" for pre-release/RC versions)'
# Required for OIDC token exchange with npm (Trusted Publishers)
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
environment: npm-publish
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Build package
working-directory: src
run: |
npm ci
npm run build
npm test
- name: Show version info
working-directory: src/dist
run: |
VERSION=$(node -p "require('./package.json').version")
echo "📦 Package: angular-cli-ghpages"
echo "📌 Version: $VERSION"
echo "🏷️ Tag: ${{ inputs.tag }}"
echo ""
if [ "${{ inputs.dry_run }}" = "true" ]; then
echo "🧪 Mode: DRY-RUN (no actual publish)"
else
echo "🚀 Mode: PUBLISH FOR REAL"
fi
- name: Publish to npm (dry-run)
if: ${{ inputs.dry_run }}
working-directory: src/dist
run: |
echo ""
echo "==============="
npm publish --provenance --tag ${{ inputs.tag }} --dry-run
echo "==============="
echo ""
echo "✅ Dry-run successful! Package is ready to publish."
echo " To publish for real, run this workflow again with dry_run unchecked."
- name: Publish to npm
if: ${{ !inputs.dry_run }}
working-directory: src/dist
run: |
echo ""
echo "==============="
npm publish --provenance --tag ${{ inputs.tag }}
echo "==============="
echo ""
echo "✅ Published successfully with provenance!"
echo " https://www.npmjs.com/package/angular-cli-ghpages"