Release #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_run: | |
workflows: | |
- ci | |
types: | |
- completed | |
jobs: | |
release: | |
name: Create Release | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Install dependencies | |
run: bun install | |
- name: Get current and previous version | |
id: version | |
run: | | |
PREV_VERSION=$(git tag --list --sort=-v:refname 'v*' | head -n 1 | sed 's/v//') | |
CURR_VERSION=$(node -p "require('./package.json').version") | |
echo "Previous Version: $PREV_VERSION" | |
echo "Current Version: $CURR_VERSION" | |
if [ "$PREV_VERSION" = "$CURR_VERSION" ]; then | |
echo "Version unchanged. Exiting..." | |
exit 1 | |
fi | |
echo "version=$CURR_VERSION" >> $GITHUB_OUTPUT | |
- name: Generate Changelog | |
id: changelog | |
uses: orhun/git-cliff-action@v2 | |
with: | |
args: --output CHANGELOG.md | |
env: | |
GIT_CLIFF_CONFIG: | | |
[changelog] | |
header = "## Changelog" | |
footer = "" | |
trim = true | |
[commit-types] | |
feat = "✨ Features" | |
fix = "🐛 Bug Fixes" | |
docs = "📝 Documentation" | |
chore = "📦 Chores" | |
refactor = "♻️ Refactors" | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ steps.version.outputs.version }} | |
name: Release v${{ steps.version.outputs.version }} | |
body_path: CHANGELOG.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to npm | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
bun publish | |
env: | |
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} |