Skip to content

Auto-reload page after server restart completes #39

Auto-reload page after server restart completes

Auto-reload page after server restart completes #39

Workflow file for this run

name: Publish to npm
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
environment: npm-publish
permissions:
contents: write
id-token: write # Required for OIDC
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from package.json
id: version
run: |
VERSION=$(jq -r '.version' package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Setup Bun
if: steps.check_tag.outputs.exists == 'false'
uses: oven-sh/setup-bun@v2
- name: Setup Node.js
if: steps.check_tag.outputs.exists == 'false'
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Setup mise
if: steps.check_tag.outputs.exists == 'false'
uses: jdx/mise-action@v2
- name: Install dependencies
if: steps.check_tag.outputs.exists == 'false'
run: bun install
- name: Build CLI
if: steps.check_tag.outputs.exists == 'false'
run: mise run cli:build
- name: Publish to npm
if: steps.check_tag.outputs.exists == 'false'
working-directory: cli
run: npm publish --access public --provenance
- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.version.outputs.tag }}
git push origin ${{ steps.version.outputs.tag }}
- name: Generate changelog
if: steps.check_tag.outputs.exists == 'false'
id: changelog
run: |
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]' | head -2 | tail -1)
if [ -z "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s" HEAD)
else
CHANGELOG=$(git log --pretty=format:"- %s" ${PREVIOUS_TAG}..HEAD~1)
fi
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
if: steps.check_tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
body: |
## Changes
${{ steps.changelog.outputs.changelog }}
## Installation
```bash
npm install -g vibora
```