Skip to content

chore(philjs-ai): Fix build configuration and add plugin reflection #156

chore(philjs-ai): Fix build configuration and add plugin reflection

chore(philjs-ai): Fix build configuration and add plugin reflection #156

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Run tests
run: pnpm test
- name: Check bundle sizes
run: pnpm size
- name: Create release PR or publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
commit: 'chore: version packages'
title: 'chore: version packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v7
with:
script: |
const publishedPackages = JSON.parse('${{ steps.changesets.outputs.publishedPackages }}');
for (const pkg of publishedPackages) {
const tagName = `${pkg.name}@${pkg.version}`;
try {
await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tagName,
name: `${pkg.name} v${pkg.version}`,
body: `Release of ${pkg.name} version ${pkg.version}`,
draft: false,
prerelease: pkg.version.includes('-')
});
console.log(`Created release for ${tagName}`);
} catch (error) {
console.error(`Failed to create release for ${tagName}:`, error);
}
}
- name: Publish release notification
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v7
with:
script: |
const publishedPackages = JSON.parse('${{ steps.changesets.outputs.publishedPackages }}');
if (publishedPackages.length === 0) {
console.log('No packages were published');
return;
}
const packageList = publishedPackages
.map(pkg => `- ${pkg.name}@${pkg.version}`)
.join('\n');
const body = `## Packages Published\n\n${packageList}\n\nView on npm: ${publishedPackages.map(pkg => `[${pkg.name}](https://www.npmjs.com/package/${pkg.name})`).join(', ')}`;
// Create a discussion or issue for the release
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Release: ${publishedPackages.length} package(s) published`,
body: body,
labels: ['release']
});