mirror of
https://github.com/uni-stack/uniwind.git
synced 2026-09-14 20:07:03 +08:00
129 lines
3.7 KiB
YAML
129 lines
3.7 KiB
YAML
name: Release Package
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry_run:
|
|
description: 'Dry run (skip actual publish)'
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
increment:
|
|
description: 'Version increment (prerelease, patch, minor, major)'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- prerelease
|
|
- patch
|
|
- minor
|
|
- major
|
|
default: patch
|
|
pre_release:
|
|
description: 'Pre-release identifier (e.g. beta, alpha, rc) — leave empty for a stable release'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
environment: npm-publish
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: .bun-version
|
|
|
|
- name: Setup Node.js (for npm with OIDC support)
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Build library
|
|
run: bun run build
|
|
|
|
- name: Check types
|
|
run: bun run check:typescript
|
|
|
|
- name: Check test types
|
|
run: bun run check:typescript:test
|
|
working-directory: packages/uniwind
|
|
|
|
- name: Check linting and formatting
|
|
run: bun run lint
|
|
|
|
- name: Check circular dependencies
|
|
run: bun run circular:check
|
|
|
|
- name: Install Playwright browsers
|
|
run: bunx playwright install --with-deps chromium
|
|
working-directory: packages/uniwind
|
|
|
|
- name: Run tests
|
|
run: bun run test
|
|
|
|
- name: Release
|
|
working-directory: packages/uniwind
|
|
run: |
|
|
PRE_RELEASE="${{ inputs.pre_release }}"
|
|
INCREMENT="${{ inputs.increment }}"
|
|
DRY_RUN="${{ inputs.dry_run }}"
|
|
|
|
ARGS="--ci $INCREMENT"
|
|
|
|
if [ -n "$PRE_RELEASE" ]; then
|
|
ARGS="$ARGS --preRelease=$PRE_RELEASE"
|
|
fi
|
|
|
|
if [ "$DRY_RUN" = "true" ]; then
|
|
ARGS="$ARGS --dry-run"
|
|
fi
|
|
|
|
npx release-it $ARGS
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Close pending release issues
|
|
if: ${{ inputs.dry_run == false }}
|
|
working-directory: packages/uniwind
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
VERSION="$(node -p "require('./package.json').version")"
|
|
TAG="v$VERSION"
|
|
RELEASE_URL="$(gh release view "$TAG" --json url --jq .url)"
|
|
|
|
gh issue list --state open --label "pending-release" --json number,labels --jq '.[] | [.number, any(.labels[]; .name == "uniwind-pro")] | @tsv' | while read -r ISSUE IS_PRO; do
|
|
if [ "$IS_PRO" = "true" ]; then
|
|
MESSAGE="New release is published: https://docs.uniwind.dev/pro/changelog"
|
|
else
|
|
MESSAGE="New release $TAG is published: $RELEASE_URL"
|
|
fi
|
|
|
|
gh issue edit "$ISSUE" --remove-label "pending-release" || echo "::warning::failed to remove label on #$ISSUE"
|
|
gh issue comment "$ISSUE" --body "$MESSAGE" || echo "::warning::failed to comment on #$ISSUE"
|
|
gh issue close "$ISSUE" || echo "::warning::failed to close #$ISSUE"
|
|
done
|