Skip to content

Commit 45ae718

Browse files
ci: Update workflows to publish on release and add CI checks
1 parent 771d0f1 commit 45ae718

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '18'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build
26+
run: npm run build
27+
28+
- name: Check build output
29+
run: |
30+
if [ ! -f "dist/nodes/CountryStateCity/CountryStateCity.node.js" ]; then
31+
echo "Build failed: CountryStateCity.node.js not found"
32+
exit 1
33+
fi
34+
echo "Build successful: All required files generated"

.github/workflows/release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Release and Publish
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
release:
5+
types: [published]
76

87
jobs:
98
release:
@@ -12,15 +11,27 @@ jobs:
1211
steps:
1312
- name: Checkout
1413
uses: actions/checkout@v3
14+
1515
- name: Setup Node.js
1616
uses: actions/setup-node@v3
1717
with:
1818
node-version: '18'
1919
registry-url: 'https://registry.npmjs.org/'
20+
21+
- name: Get release version
22+
id: get_version
23+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
24+
25+
- name: Update package.json version
26+
run: |
27+
npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version
28+
2029
- name: Install dependencies
2130
run: npm ci
31+
2232
- name: Build
2333
run: npm run build
34+
2435
- name: Publish to npm
2536
run: npm publish --access public
2637
env:

0 commit comments

Comments
 (0)