Skip to content

Commit 207ae79

Browse files
authored
Merge pull request #730 from SolidOS/github-release
Implement GitHub release creation in CI workflow
2 parents 2ff8884 + a114369 commit 207ae79

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/ci.yml

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

0 commit comments

Comments
 (0)