@@ -240,12 +240,22 @@ jobs:
240240 git commit -m "chore: bump version to ${VERSION}"
241241 echo "did_commit=true" >> "$GITHUB_OUTPUT"
242242
243+ - name : Tag version
244+ if : steps.commit.outputs.did_commit == 'true'
245+ env :
246+ VERSION : ${{ steps.bump.outputs.version }}
247+ run : |
248+ if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
249+ git tag -d "v${VERSION}"
250+ fi
251+ git tag -a "v${VERSION}" -m "v${VERSION}"
252+
243253 - name : Push version bump
244254 if : steps.commit.outputs.did_commit == 'true'
245255 env :
246256 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
247257 run : |
248- git push
258+ git push --follow-tags
249259
250260 - name : Configure npm auth
251261 run : echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
@@ -254,3 +264,22 @@ jobs:
254264
255265 - name : Publish release
256266 run : npm publish --access public
267+
268+ - name : Create GitHub release
269+ if : steps.commit.outputs.did_commit == 'true'
270+ env :
271+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
272+ VERSION : ${{ steps.bump.outputs.version }}
273+ run : |
274+ RELEASE_TAG="v${VERSION}"
275+ RELEASE_URL="https://www.npmjs.com/package/@omarsdev/react-native-contacts/v/${VERSION}"
276+
277+ if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
278+ echo "GitHub release $RELEASE_TAG already exists"
279+ exit 0
280+ fi
281+
282+ gh release create "$RELEASE_TAG" \
283+ --latest \
284+ --title "$RELEASE_TAG" \
285+ --notes "Published on npm: ${RELEASE_URL}"
0 commit comments