Merge pull request #1036 from streamich/server-demo-improvements #311
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| inputs: | |
| version_bump: | |
| description: 'Version bump type (leave empty for auto-detect from commits)' | |
| required: false | |
| type: choice | |
| options: | |
| - '' | |
| - major | |
| - minor | |
| - patch | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| registry-url: https://registry.npmjs.org | |
| - name: Enable corepack | |
| run: corepack enable | |
| - name: Install dependencies | |
| run: yarn | |
| - name: Run lint | |
| run: yarn lint | |
| - name: Run format check | |
| run: yarn format | |
| - name: Clean | |
| run: yarn clean | |
| - name: Build | |
| run: yarn build | |
| - name: Run typecheck | |
| run: yarn typecheck | |
| - name: Bundle mutxt-element (Webpack) | |
| run: yarn workspace mutxt-element run bundle | |
| - name: Build mu-txt Electron (renderer + main process) | |
| run: yarn workspace mu-txt run electron:build | |
| - name: Run tests (vitest) | |
| run: yarn vitest | |
| - name: Run tests (jest) | |
| run: yarn test | |
| env: | |
| CI: true | |
| - name: Generate typedoc | |
| run: yarn typedoc | |
| - name: Determine version bump | |
| id: version-bump | |
| run: | | |
| if [ -n "${{ github.event.inputs.version_bump }}" ]; then | |
| VERSION_BUMP="${{ github.event.inputs.version_bump }}" | |
| else | |
| VERSION_BUMP=$(./scripts/version-bump.sh) | |
| fi | |
| echo "bump=$VERSION_BUMP" >> $GITHUB_OUTPUT | |
| echo "Version bump type: $VERSION_BUMP" | |
| - name: Check if release is needed | |
| if: steps.version-bump.outputs.bump == 'no-bump' | |
| run: | | |
| echo "No version bump needed based on commit messages. Skipping release." | |
| exit 0 | |
| - name: Update version in root package.json | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| run: npm version --allow-same-version --no-git-tag-version "${{ steps.version-bump.outputs.bump }}" | |
| - name: Get new version | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| id: new-version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Sync versions across all packages | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| run: node --experimental-strip-types --no-warnings=ExperimentalWarning ./scripts/sync-versions.ts | |
| - name: Configure Git | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Commit and tag release | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| run: | | |
| git add . | |
| git commit -m "chore: release v${{ steps.new-version.outputs.version }}" | |
| git tag "v${{ steps.new-version.outputs.version }}" | |
| - name: Push changes | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| run: | | |
| git push origin master | |
| git push origin "v${{ steps.new-version.outputs.version }}" | |
| - name: Publish to NPM with provenance | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| for pkg in packages/*/; do | |
| if [ -f "$pkg/package.json" ] && [ "$(jq -r '.private // false' "$pkg/package.json")" != "true" ]; then | |
| echo "Publishing $pkg..." | |
| cd "$pkg" | |
| yarn pack -o package.tgz | |
| npm publish package.tgz --provenance --access public | |
| rm package.tgz | |
| cd - > /dev/null | |
| fi | |
| done | |
| - name: Create GitHub Release | |
| if: steps.version-bump.outputs.bump != 'no-bump' | |
| run: | | |
| gh release create "v${{ steps.new-version.outputs.version }}" \ | |
| --title "Release v${{ steps.new-version.outputs.version }}" \ | |
| --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |