Skip to content

Commit ac48626

Browse files
committed
Fixed: the release createion based on the tag
1 parent 2bdb701 commit ac48626

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
# This workflow publishes packages when a release tag is pushed
1+
# This workflow publishes packages when a GitHub Release is created for a version tag.
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
33

44
name: Publish package to NPM repository
55
on:
6-
push:
7-
tags:
8-
- 'v*'
6+
release:
7+
types: [created]
98

109
jobs:
1110
publish-npm:
11+
if: ${{ startsWith(github.event.release.tag_name, 'v') && !github.event.release.draft }}
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.release.tag_name }}
1517
- uses: actions/setup-node@v4
1618
with:
1719
node-version: '22.x'
@@ -21,9 +23,12 @@ jobs:
2123
env:
2224
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2325
publish-git:
26+
if: ${{ startsWith(github.event.release.tag_name, 'v') && !github.event.release.draft }}
2427
runs-on: ubuntu-latest
2528
steps:
2629
- uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event.release.tag_name }}
2732
- uses: actions/setup-node@v4
2833
with:
2934
node-version: '22.x'

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ npm run download-regions # regions.json only (also run as part of prebuild)
2929

3030
`npm test` runs **`pretest``npm run build`**, then Jest with coverage; outputs under **`reports/`**. Use **`npm run test:debug`** for Jest watch mode (`--runInBand`).
3131

32-
**CI:** `.github/workflows/ci.yml` (unit tests / coverage on `development`, `master`). Publish: `.github/workflows/npm-publish.yml` (on tag push `v*`). Back-merge automation: `.github/workflows/back-merge-pr.yml`.
32+
**CI:** `.github/workflows/ci.yml` (unit tests / coverage on `development`, `master`). Publish: `.github/workflows/npm-publish.yml` (GitHub **Release** created for tag `v*`; draft releases are skipped). Back-merge automation: `.github/workflows/back-merge-pr.yml`.
3333

3434
Install: `npm i @contentstack/utils` — see root **`README.md`** and **`package.json`** for the current version.
3535

skills/dev-workflow/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ description: Branches, CI, build/test/lint commands, git hooks, PR expectations,
4343

4444
- Version in **`package.json`** and **`CHANGELOG.md`**.
4545
- **`prepublishOnly`** runs **`npm test`**.
46-
- **npm / GitHub Packages:** `.github/workflows/npm-publish.yml` on **tag push (`v*`)**; secrets `NPM_TOKEN`, `GIT_TOKEN` (maintainers).
46+
- **npm / GitHub Packages:** `.github/workflows/npm-publish.yml` on **`release: types: [created]`** for tag **`v*`** (draft releases skipped); secrets `NPM_TOKEN`, `GIT_TOKEN` (maintainers).

0 commit comments

Comments
 (0)