Skip to content

Commit d459f55

Browse files
committed
chore: remove deprecated Node CI workflow and update publish workflow for improved build and testing
1 parent 3203bec commit d459f55

2 files changed

Lines changed: 41 additions & 111 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,58 @@ on:
44
release:
55
types: [published]
66

7-
87
jobs:
98
build:
10-
119
runs-on: ubuntu-latest
1210

1311
strategy:
1412
matrix:
1513
node-version: [18.x]
1614

1715
steps:
18-
- uses: actions/checkout@v1
19-
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v1
21-
with:
22-
node-version: ${{ matrix.node-version }}
23-
- name: npm install, build, and test
24-
run: |
25-
npm install -g @angular/cli@17.3.17
26-
npm run build
16+
- uses: actions/checkout@v1
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- name: Build and Test
22+
run: |
23+
npm install
24+
npm run build
25+
npm pack
26+
cd test-app
27+
npm install
28+
npm install ../dist/imagekit-angular/imagekit-angular-*.tgz --no-save
29+
npm run test:e2e
30+
env:
31+
CI: true
32+
2733

2834
publish:
2935
needs: build
3036
runs-on: ubuntu-latest
3137
steps:
32-
- uses: actions/checkout@v1
33-
- uses: actions/setup-node@v1
34-
with:
35-
node-version: 14
36-
registry-url: https://registry.npmjs.org/
37-
- name: npm publish
38-
run: |
39-
npm install -g @angular/cli@17.3.17
40-
npm run build
41-
cd dist/imagekit-angular
42-
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
43-
npm publish
44-
env:
45-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
38+
- uses: actions/checkout@v1
39+
- uses: actions/setup-node@v1
40+
with:
41+
node-version: 18
42+
registry-url: https://registry.npmjs.org/
43+
- name: NPM Publish
44+
run: |
45+
npm install
46+
npm run build
47+
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
48+
# print the NPM user name for validation
49+
npm whoami
50+
VERSION=$(node -p "require('./projects/imagekit-angular/package.json').version" )
51+
# Only publish stable versions to the latest tag
52+
if [[ "$VERSION" =~ ^[^-]+$ ]]; then
53+
NPM_TAG="latest"
54+
else
55+
NPM_TAG="beta"
56+
fi
57+
echo "Publishing $VERSION with $NPM_TAG tag."
58+
npm publish --tag $NPM_TAG --access public
59+
env:
60+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
61+
CI: true

0 commit comments

Comments
 (0)