Skip to content

Smarter onboarding: install hints, Docker detection, NO_BACKEND error… #2

Smarter onboarding: install hints, Docker detection, NO_BACKEND error…

Smarter onboarding: install hints, Docker detection, NO_BACKEND error… #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # needed for gh release create
id-token: write # needed for npm provenance OIDC
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Install LibreOffice (for smoke test)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libreoffice
- run: npm ci || npm install
- run: npm test
- name: Verify package.json version matches tag
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION="${GITHUB_REF_NAME#v}"
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: package.json=$PKG_VERSION, tag=$TAG_VERSION" >&2
exit 1
fi
- name: Publish to npm with provenance
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
# Body: pull the section from CHANGELOG.md for this version, fall back to autogen.
if [ -f CHANGELOG.md ]; then
awk -v v="${GITHUB_REF_NAME#v}" '
/^## \[/ {
if (matched) exit
if (index($0, "[" v "]")) { matched=1; next }
}
matched { print }
' CHANGELOG.md > /tmp/release-notes.md
fi
if [ ! -s /tmp/release-notes.md ]; then
gh release create "$GITHUB_REF_NAME" --generate-notes --title "$GITHUB_REF_NAME"
else
gh release create "$GITHUB_REF_NAME" --notes-file /tmp/release-notes.md --title "$GITHUB_REF_NAME"
fi