Skip to content

Commit 271fa4d

Browse files
committed
ci: trunk-based release — publish on version tags, single main branch
- publish.yml triggers on 'v*' tags instead of pushing to a release branch, and verifies the tag matches package.json before publishing - ci.yml runs on main + PRs only (drop development/production env branches) - dependabot targets main For a library, releases are npm versions marked by git tags, not deploy-style env branches. Companion manual step: rename default branch production -> main and delete development.
1 parent 5c1d039 commit 271fa4d

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ updates:
99
time: "09:00"
1010
timezone: "America/Guayaquil"
1111
open-pull-requests-limit: 10
12-
target-branch: "development"
12+
target-branch: "main"
1313
groups:
1414
strapi:
1515
patterns:
@@ -37,4 +37,4 @@ updates:
3737
time: "09:00"
3838
timezone: "America/Guayaquil"
3939
open-pull-requests-limit: 5
40-
target-branch: "development"
40+
target-branch: "main"

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- development
8-
- production
97
pull_request:
108

119
jobs:

.github/workflows/publish.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Publish to npm
22

33
on:
44
push:
5-
branches:
6-
- production
5+
tags:
6+
- 'v*'
77

88
jobs:
99
publish:
@@ -63,20 +63,22 @@ jobs:
6363
echo "tag=latest" >> $GITHUB_OUTPUT
6464
fi
6565
66+
- name: Verify tag matches package version
67+
run: |
68+
if [ "${{ github.ref_name }}" != "v${{ steps.pkg.outputs.version }}" ]; then
69+
echo "❌ Tag ${{ github.ref_name }} does not match package.json version v${{ steps.pkg.outputs.version }}."
70+
exit 1
71+
fi
72+
6673
- name: Publish to npm
6774
run: npm publish --access public --tag ${{ steps.tag.outputs.tag }}
6875
env:
6976
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7077

71-
- name: Create git tag
72-
run: |
73-
git tag v${{ steps.pkg.outputs.version }}
74-
git push origin v${{ steps.pkg.outputs.version }}
75-
7678
- name: Create GitHub release
7779
uses: softprops/action-gh-release@v2
7880
with:
79-
tag_name: v${{ steps.pkg.outputs.version }}
80-
name: v${{ steps.pkg.outputs.version }}
81+
tag_name: ${{ github.ref_name }}
82+
name: ${{ github.ref_name }}
8183
generate_release_notes: true
8284
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)