@contrail/flexplm 1.3.0-alpha.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
name: Publish to NPM
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
paths-ignore:
|
|
7
|
+
- '.github/**'
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [master]
|
|
10
|
+
paths-ignore:
|
|
11
|
+
- '.github/**'
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
check-version:
|
|
15
|
+
name: Verify version is available on npm
|
|
16
|
+
if: github.event_name == 'pull_request'
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Check version not already published
|
|
22
|
+
run: |
|
|
23
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
24
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
25
|
+
echo "Checking if ${PACKAGE_NAME}@${VERSION} exists on npm..."
|
|
26
|
+
if npm view "${PACKAGE_NAME}@${VERSION}" version 2>/dev/null; then
|
|
27
|
+
echo "::error::Version ${VERSION} is already published on npm. Bump the version in package.json before merging."
|
|
28
|
+
exit 1
|
|
29
|
+
else
|
|
30
|
+
echo "Version ${VERSION} is available."
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
publish-alpha:
|
|
34
|
+
name: Publish alpha
|
|
35
|
+
if: github.event_name == 'pull_request'
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
outputs:
|
|
38
|
+
version: ${{ steps.publish.outputs.version }}
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- uses: actions/setup-node@v4
|
|
43
|
+
with:
|
|
44
|
+
node-version: '20'
|
|
45
|
+
registry-url: 'https://registry.npmjs.org'
|
|
46
|
+
|
|
47
|
+
- name: Install and build
|
|
48
|
+
env:
|
|
49
|
+
NPM_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
50
|
+
NODE_AUTH_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
51
|
+
run: npm ci && npm run build
|
|
52
|
+
|
|
53
|
+
- name: Publish alpha
|
|
54
|
+
id: publish
|
|
55
|
+
run: |
|
|
56
|
+
SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)
|
|
57
|
+
VERSION=$(node -p "require('./package.json').version")-alpha.${SHORT_SHA}
|
|
58
|
+
npm version $VERSION --no-git-tag-version
|
|
59
|
+
OUTPUT=$(npm publish --tag alpha 2>&1) && {
|
|
60
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
61
|
+
} || {
|
|
62
|
+
if echo "$OUTPUT" | grep -q "You cannot publish over the previously published versions"; then
|
|
63
|
+
echo "::warning::Alpha ${VERSION} already published, skipping."
|
|
64
|
+
else
|
|
65
|
+
echo "::error::Failed to publish alpha ${VERSION}"
|
|
66
|
+
echo "$OUTPUT"
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
}
|
|
70
|
+
env:
|
|
71
|
+
NPM_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
72
|
+
NODE_AUTH_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
73
|
+
|
|
74
|
+
publish-release:
|
|
75
|
+
name: Publish release
|
|
76
|
+
if: github.event_name == 'push'
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
outputs:
|
|
79
|
+
version: ${{ steps.publish.outputs.version }}
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
|
|
83
|
+
- uses: actions/setup-node@v4
|
|
84
|
+
with:
|
|
85
|
+
node-version: '20'
|
|
86
|
+
registry-url: 'https://registry.npmjs.org'
|
|
87
|
+
|
|
88
|
+
- name: Install and build
|
|
89
|
+
env:
|
|
90
|
+
NPM_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
91
|
+
NODE_AUTH_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
92
|
+
run: npm ci && npm run build
|
|
93
|
+
|
|
94
|
+
- name: Publish release
|
|
95
|
+
id: publish
|
|
96
|
+
run: |
|
|
97
|
+
npm publish
|
|
98
|
+
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
99
|
+
env:
|
|
100
|
+
NPM_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
101
|
+
NODE_AUTH_TOKEN: ${{ secrets.ZACH_NPM_TOKEN_4 }}
|
|
102
|
+
|
|
103
|
+
verify-install:
|
|
104
|
+
name: Verify public install
|
|
105
|
+
needs: [publish-alpha, publish-release]
|
|
106
|
+
if: always() && (needs.publish-alpha.outputs.version || needs.publish-release.outputs.version)
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
steps:
|
|
109
|
+
- name: Install without auth
|
|
110
|
+
run: |
|
|
111
|
+
VERSION="${{ needs.publish-alpha.outputs.version || needs.publish-release.outputs.version }}"
|
|
112
|
+
echo "Verifying @contrail/flexplm@${VERSION} can be installed without auth..."
|
|
113
|
+
mkdir /tmp/install-test && cd /tmp/install-test
|
|
114
|
+
npm init -y > /dev/null
|
|
115
|
+
for attempt in 1 2 3; do
|
|
116
|
+
if npm install @contrail/flexplm@${VERSION} --no-save 2>/dev/null; then
|
|
117
|
+
echo "Install verified successfully."
|
|
118
|
+
exit 0
|
|
119
|
+
fi
|
|
120
|
+
echo "Attempt ${attempt} failed, waiting 10s for registry propagation..."
|
|
121
|
+
sleep 10
|
|
122
|
+
done
|
|
123
|
+
echo "::error::Failed to install @contrail/flexplm@${VERSION} after 3 attempts"
|
|
124
|
+
exit 1
|