mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
Some checks failed
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
91 lines
2.7 KiB
YAML
91 lines
2.7 KiB
YAML
name: Publish and Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
env:
|
|
TELEMETRY_TRACKING_TOKEN: ${{ secrets.TELEMETRY_TRACKING_TOKEN }}
|
|
DO_NOT_TRACK: '1'
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
publish-and-release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 10.12.1
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.x
|
|
cache: 'pnpm'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Use Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: |
|
|
pnpm run build
|
|
pnpm tsx packages/cli/scripts/post-build.ts
|
|
|
|
- name: Get version from package.json
|
|
id: version
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Publish packages
|
|
run: pnpm run publish-all
|
|
env:
|
|
NPM_CONFIG_PROVENANCE: 'true'
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
|
|
if [ -z "$PREVIOUS_TAG" ]; then
|
|
CHANGELOG=$(git log --oneline --no-merges --format="* %s" HEAD)
|
|
else
|
|
CHANGELOG=$(git log --oneline --no-merges --format="* %s" ${PREVIOUS_TAG}..HEAD)
|
|
fi
|
|
|
|
if [ -z "$CHANGELOG" ]; then
|
|
CHANGELOG="* Automated release"
|
|
fi
|
|
|
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.tag }}
|
|
name: ZenStack Release ${{ steps.version.outputs.tag }}
|
|
body: |
|
|
## Changes in this release
|
|
|
|
${{ steps.changelog.outputs.changelog }}
|
|
draft: true
|