Skip to content

Commit fcff781

Browse files
authored
Merge pull request #239 from SolidOS/github-release
Implement GitHub release creation in CI workflow
2 parents 8343603 + 500eb6b commit fcff781

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

0 commit comments

Comments
 (0)