Skip to content

Commit f7ce75b

Browse files
committed
chore(ci): Create or Update Release
Signed-off-by: Khaled Sameer <[email protected]>
1 parent 6fd9537 commit f7ce75b

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

.github/workflows/release.yml

+20-9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
registry-url: 'https://registry.npmjs.org'
3737

3838
- name: Install dependencies
39-
run: yarn install
39+
run: yarn install
4040

4141
- name: Build packages
4242
run: yarn build
@@ -49,16 +49,27 @@ jobs:
4949
- name: Generate changelog
5050
run: yarn generate-changelog
5151

52-
- name: Create GitHub Release
52+
- name: Create or Update Release
5353
env:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
uses: actions/create-release@v1
56-
with:
57-
tag_name: ${{ github.ref }}
58-
release_name: Release ${{ github.ref }}
59-
body_path: ./CHANGELOG.md
60-
draft: false
61-
prerelease: false
55+
run: |
56+
TAG_NAME=${GITHUB_REF#refs/tags/}
57+
58+
# Read the changelog content
59+
CHANGELOG_CONTENT=$(cat ./CHANGELOG.md)
60+
61+
# Check if release exists
62+
if gh release view "$TAG_NAME" &>/dev/null; then
63+
echo "Updating existing release for $TAG_NAME"
64+
gh release edit "$TAG_NAME" \
65+
--title "Release $TAG_NAME" \
66+
--notes "$CHANGELOG_CONTENT"
67+
else
68+
echo "Creating new release for $TAG_NAME"
69+
gh release create "$TAG_NAME" \
70+
--title "Release $TAG_NAME" \
71+
--notes "$CHANGELOG_CONTENT"
72+
fi
6273
6374
- name: Setup NPM Authentication
6475
run: |

0 commit comments

Comments
 (0)