1212 runs-on : ubuntu-latest
1313 permissions :
1414 contents : read
15- id-token : write # Required for npm publish with OIDC
15+ id-token : write
1616
1717 steps :
1818 - name : Checkout
@@ -27,24 +27,27 @@ jobs:
2727 - name : Install dependencies
2828 run : npm ci
2929
30- - name : Run tests
31- run : npm test
32-
3330 - name : Build
3431 run : npm run build
3532
3633 - name : Extract version
3734 id : version
38- run : echo "VERSION=$(node -p.json').version\ \"require('./package")" >> $GITHUB_OUTPUT
35+ run : |
36+ VERSION=$(node -p "require('./package.json').version")
37+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
38+ echo "Found version: $VERSION"
3939
4040 - name : Check version tag
4141 id : check-tag
4242 run : |
4343 TAG_VERSION="v${{ steps.version.outputs.VERSION }}"
44+ echo "Checking for tag: $TAG_VERSION"
4445 if git rev-parse "refs/tags/$TAG_VERSION" > /dev/null 2>&1; then
4546 echo "tag_exists=true" >> $GITHUB_OUTPUT
47+ echo "Tag exists, will publish"
4648 else
4749 echo "tag_exists=false" >> $GITHUB_OUTPUT
50+ echo "Tag does not exist, skipping publish"
4851 fi
4952
5053 - name : Publish to npm (on tag)
6366 release_name : TaskFlow AI v${{ steps.version.outputs.VERSION }}
6467 draft : false
6568 prerelease : false
66-
67- # Optional: Publish to npm on every main push (without tag)
68- publish-latest :
69- runs-on : ubuntu-latest
70- if : github.event_name == 'workflow_dispatch'
71- permissions :
72- contents : read
73- id-token : write
74- steps :
75- - uses : actions/checkout@v4
76- - uses : actions/setup-node@v4
77- with :
78- node-version : ' 20'
79- registry-url : ' https://registry.npmjs.org'
80- - run : npm ci
81- - run : npm run build
82- - run : npm publish --access public
83- env :
84- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments