Skip to content

Commit 5b97eff

Browse files
authored
Merge pull request #592 from SolidOS/github-release
Add GitHub release step to CI workflow
2 parents 1632118 + 51a083b commit 5b97eff

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,32 @@ jobs:
8282
- name: Publish to npm
8383
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
8484
run: npm publish --tag latest
85+
86+
github-release:
87+
needs: [npm-publish-latest]
88+
runs-on: ubuntu-latest
89+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
90+
permissions:
91+
contents: write
92+
steps:
93+
- uses: actions/checkout@v6
94+
with:
95+
fetch-depth: 0
96+
- name: Create GitHub release with generated notes
97+
env:
98+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
run: |
100+
TAG="v$(node -p "require('./package.json').version")"
101+
102+
if gh release view "$TAG" >/dev/null 2>&1; then
103+
echo "Release $TAG already exists. Skipping."
104+
exit 0
105+
fi
106+
107+
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then
108+
echo "Tag $TAG already exists on origin. Creating release from existing tag."
109+
gh release create "$TAG" --verify-tag --generate-notes
110+
else
111+
echo "Creating tag and release $TAG from commit $GITHUB_SHA."
112+
gh release create "$TAG" --target "$GITHUB_SHA" --generate-notes
113+
fi

0 commit comments

Comments
 (0)