Skip to content

Commit 07361ca

Browse files
committed
artificial bump to 0.1.2 to test ci/cd workflow
1 parent c9f32d8 commit 07361ca

4 files changed

Lines changed: 37 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
pull_request:
55
push:
6-
branches: ["main"]
6+
branches: ["main", "master"]
77

88
permissions:
99
contents: read

.github/workflows/publish.yml

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,28 @@ name: Publish
33
on:
44
release:
55
types: [published]
6+
push:
7+
tags:
8+
- "v*"
69

710
permissions:
811
contents: read
912
id-token: write
1013

1114
jobs:
1215
publish:
13-
if: github.event.release.prerelease == false
16+
if: |
17+
(github.event_name == 'release' && github.event.release.prerelease == false) ||
18+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
1419
runs-on: ubuntu-latest
20+
env:
21+
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref_name }}
1522

1623
steps:
17-
- name: Checkout release tag
24+
- name: Checkout release/tag ref
1825
uses: actions/checkout@v4
1926
with:
20-
ref: ${{ github.event.release.tag_name }}
27+
ref: ${{ env.RELEASE_TAG }}
2128

2229
- name: Setup Node
2330
uses: actions/setup-node@v4
@@ -26,25 +33,38 @@ jobs:
2633
registry-url: https://registry.npmjs.org
2734
cache: npm
2835

29-
- name: Install dependencies
30-
run: npm ci
31-
3236
- name: Validate release tag matches package version
33-
env:
34-
RELEASE_TAG: ${{ github.event.release.tag_name }}
3537
run: |
3638
node -e "const fs=require('fs');const pkg=JSON.parse(fs.readFileSync('package.json','utf8'));const expected='v'+pkg.version;if(process.env.RELEASE_TAG!==expected){console.error('Tag/version mismatch: '+process.env.RELEASE_TAG+' != '+expected);process.exit(1);}"
3739
40+
- name: Check if version already exists on npm
41+
id: npm_version
42+
run: |
43+
PKG_NAME="$(node -p "require('./package.json').name")"
44+
PKG_VERSION="$(node -p "require('./package.json').version")"
45+
if npm view "${PKG_NAME}@${PKG_VERSION}" version >/dev/null 2>&1; then
46+
echo "already_published=true" >> "$GITHUB_OUTPUT"
47+
echo "Detected ${PKG_NAME}@${PKG_VERSION} on npm. Skipping publish."
48+
else
49+
echo "already_published=false" >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
- name: Install dependencies
53+
if: steps.npm_version.outputs.already_published == 'false'
54+
run: npm ci
55+
3856
- name: Isolation checks
57+
if: steps.npm_version.outputs.already_published == 'false'
3958
run: npm run test:isolation
4059

4160
- name: Test suite
61+
if: steps.npm_version.outputs.already_published == 'false'
4262
run: npm test
4363

4464
- name: Build bundle
65+
if: steps.npm_version.outputs.already_published == 'false'
4566
run: npm run build
4667

4768
- name: Publish to npm
69+
if: steps.npm_version.outputs.already_published == 'false'
4870
run: npm publish --access public --provenance
49-
env:
50-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ansonlai/docx-redline-js",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Host-independent OOXML reconciliation engine for .docx manipulation with track changes",
55
"license": "MIT",
66
"type": "module",
@@ -52,7 +52,7 @@
5252
"scripts": {
5353
"build": "node scripts/build.mjs",
5454
"test": "node scripts/run-tests.mjs",
55-
"test:isolation": "node tests/no_word_api_standalone_check.mjs && node tests/core_dependency_graph_check.mjs",
55+
"test:isolation": "node tests/no_word_api_index_check.mjs && node tests/core_dependency_graph_check.mjs",
5656
"prepublishOnly": "npm run test:isolation && npm run build"
5757
},
5858
"keywords": [
@@ -73,4 +73,4 @@
7373
"engines": {
7474
"node": ">=18.0.0"
7575
}
76-
}
76+
}

0 commit comments

Comments
 (0)