Skip to content

fix: popover

fix: popover #18

Workflow file for this run

name: Publish to NPM
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
- name: Run linter
run: yarn lint
- name: Build
run: yarn build
- name: Get version and determine tag
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Detect if version contains beta, alpha, rc, etc.
if [[ $VERSION == *"-"* ]]; then
TAG="beta"
else
TAG="latest"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Publishing version $VERSION with tag $TAG"
- name: Publish to NPM
run: npm publish --tag ${{ steps.version.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TREEGE_CI }}
- name: Create Git tag
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
- name: Generate release notes
id: release_notes
run: |
# Get the previous tag
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREV_TAG" ]; then
# First release, get all commits
COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges)
else
# Get commits since last tag
COMMITS=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
fi
# Create release notes
echo "## What's Changed" > release_notes.md
echo "" >> release_notes.md
echo "$COMMITS" >> release_notes.md
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
body_path: release_notes.md
prerelease: ${{ steps.version.outputs.tag == 'beta' }}
generate_release_notes: true