Skip to content

Commit 89b2b1c

Browse files
authored
Merge pull request #217 from vue-pivottable/develop
2 parents 461a6aa + 068531b commit 89b2b1c

File tree

6 files changed

+206
-98
lines changed

6 files changed

+206
-98
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Release Branch Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/v*'
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
deploy-and-sync:
12+
name: Deploy and Sync
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
issues: write
17+
pull-requests: write
18+
id-token: write
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '22.10.0'
30+
registry-url: 'https://registry.npmjs.org/'
31+
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v2
34+
with:
35+
version: latest
36+
37+
- name: Install dependencies
38+
run: pnpm install
39+
40+
- name: Build packages
41+
run: |
42+
echo "Building all packages..."
43+
pnpm build:all
44+
45+
- name: Publish to npm
46+
run: |
47+
# Publish with latest tag
48+
node scripts/release-packages.cjs
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52+
NPM_TOKEN_SUMIN: ${{ secrets.NPM_TOKEN_SUMIN }}
53+
54+
- name: Create GitHub Releases
55+
run: |
56+
# Create release for each package with stable version
57+
create_release() {
58+
local PKG_NAME=$1
59+
local PKG_VERSION=$2
60+
local NPM_NAME=$3
61+
62+
echo "Creating release for $PKG_NAME@$PKG_VERSION"
63+
64+
# Delete existing beta release if it exists
65+
gh release delete "${PKG_NAME}@${PKG_VERSION}" --yes 2>/dev/null || true
66+
67+
gh release create "${PKG_NAME}@${PKG_VERSION}" \
68+
--title "${PKG_NAME}@${PKG_VERSION}" \
69+
--notes "## 🚀 Stable Release
70+
71+
This release promotes the beta version to stable.
72+
73+
Install with: \`npm install ${NPM_NAME}@latest\`
74+
75+
### Version: ${PKG_VERSION}" \
76+
--target ${{ github.sha }}
77+
}
78+
79+
# Get version info from current branch
80+
CURRENT_BRANCH="${{ github.ref_name }}"
81+
VERSION="${CURRENT_BRANCH#release/v}"
82+
83+
# Check main package
84+
MAIN_VERSION=$(node -p "require('./package.json').version")
85+
if [ "$MAIN_VERSION" = "$VERSION" ]; then
86+
create_release "vue-pivottable" "$MAIN_VERSION" "vue-pivottable"
87+
fi
88+
89+
# Check sub-packages
90+
for pkg in packages/*/; do
91+
if [ -d "$pkg" ] && [ -f "$pkg/package.json" ]; then
92+
FULL_PKG_NAME=$(cd "$pkg" && node -p "require('./package.json').name")
93+
PKG_VERSION=$(cd "$pkg" && node -p "require('./package.json').version")
94+
95+
# Only create release if version doesn't contain beta
96+
if [[ $PKG_VERSION != *"-beta"* ]]; then
97+
create_release "$FULL_PKG_NAME" "$PKG_VERSION" "$FULL_PKG_NAME"
98+
fi
99+
fi
100+
done
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
104+
- name: Sync with develop
105+
run: |
106+
# Configure git
107+
git config user.name "github-actions[bot]"
108+
git config user.email "github-actions[bot]@users.noreply.github.com"
109+
110+
# Create a temporary branch for merging
111+
TEMP_BRANCH="temp-sync-$(date +%s)"
112+
git checkout -b $TEMP_BRANCH
113+
114+
# Merge into develop
115+
git checkout develop
116+
git pull origin develop
117+
git merge $TEMP_BRANCH --no-edit -m "chore: sync release ${{ github.ref_name }} to develop"
118+
git push origin develop
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Create PR to main
123+
run: |
124+
VERSION="${{ github.ref_name }}"
125+
126+
gh pr create \
127+
--base main \
128+
--head "${{ github.ref_name }}" \
129+
--title "chore: update main with $VERSION" \
130+
--body "## 📦 Release Update
131+
132+
This PR updates main branch with:
133+
- ✅ Stable version numbers (beta suffix removed)
134+
- ✅ Updated package.json files
135+
- ✅ npm packages published
136+
- ✅ GitHub releases created
137+
138+
### Published Packages
139+
$(node -p "
140+
const main = require('./package.json');
141+
let packages = \`- vue-pivottable@\${main.version}\`;
142+
const fs = require('fs');
143+
const path = require('path');
144+
const packagesDir = './packages';
145+
if (fs.existsSync(packagesDir)) {
146+
fs.readdirSync(packagesDir).forEach(dir => {
147+
const pkgPath = path.join(packagesDir, dir, 'package.json');
148+
if (fs.existsSync(pkgPath)) {
149+
const pkg = require(pkgPath);
150+
packages += \`\\n- \${pkg.name}@\${pkg.version}\`;
151+
}
152+
});
153+
}
154+
packages
155+
")
156+
157+
**Note**: This release has been automatically synced with develop branch." \
158+
|| echo "PR to main already exists or creation failed"
159+
env:
160+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 7 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -134,97 +134,12 @@ jobs:
134134
echo "release_branch=$RELEASE_BRANCH" >> $GITHUB_OUTPUT
135135
echo "version=$VERSION" >> $GITHUB_OUTPUT
136136
137-
- name: Checkout release branch and publish
137+
- name: Trigger release branch workflow
138138
if: steps.check-versions.outputs.has_beta == 'true'
139139
run: |
140-
# Checkout to release branch for publishing
141-
git checkout ${{ steps.create-release.outputs.release_branch }}
142-
143-
# Publish with latest tag (overwrites beta)
144-
node scripts/release-packages.cjs
145-
env:
146-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
147-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
148-
NPM_TOKEN_SUMIN: ${{ secrets.NPM_TOKEN_SUMIN }}
149-
150-
- name: Create GitHub Releases
151-
if: steps.check-versions.outputs.has_beta == 'true'
152-
run: |
153-
# Create release for each package with stable version
154-
create_release() {
155-
local PKG_NAME=$1
156-
local PKG_VERSION=$2
157-
local NPM_NAME=$3
158-
159-
echo "Creating release for $PKG_NAME@$PKG_VERSION"
160-
161-
# Delete existing release if it exists (likely a beta version)
162-
gh release delete "${PKG_NAME}@${PKG_VERSION}" --yes 2>/dev/null || true
163-
164-
gh release create "${PKG_NAME}@${PKG_VERSION}" \
165-
--title "${PKG_NAME}@${PKG_VERSION}" \
166-
--notes "## 🚀 Stable Release
167-
168-
This release promotes the beta version to stable.
169-
170-
Install with: \`npm install ${NPM_NAME}@latest\`
171-
172-
### Version: ${PKG_VERSION}" \
173-
--target ${{ github.sha }}
174-
}
175-
176-
# Only create releases for packages that had beta versions
177-
BETA_PACKAGES="${{ steps.check-versions.outputs.beta_packages }}"
178-
179-
# Check if main package had beta
180-
if [[ " $BETA_PACKAGES " == *" vue-pivottable "* ]]; then
181-
MAIN_VERSION=$(node -p "require('./package.json').version")
182-
create_release "vue-pivottable" "$MAIN_VERSION" "vue-pivottable"
183-
fi
184-
185-
# Check sub-packages
186-
for pkg in packages/*/; do
187-
if [ -d "$pkg" ] && [ -f "$pkg/package.json" ]; then
188-
PKG_NAME=$(basename "$pkg")
189-
# Only process if this package had beta version
190-
if [[ " $BETA_PACKAGES " == *" $PKG_NAME "* ]]; then
191-
FULL_PKG_NAME=$(cd "$pkg" && node -p "require('./package.json').name")
192-
PKG_VERSION=$(cd "$pkg" && node -p "require('./package.json').version")
193-
create_release "$FULL_PKG_NAME" "$PKG_VERSION" "$FULL_PKG_NAME"
194-
fi
195-
fi
196-
done
197-
env:
198-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
199-
200-
- name: Create PR to update main
201-
if: steps.check-versions.outputs.has_beta == 'true'
202-
run: |
203-
# Create PR from release branch back to main
204-
gh pr create \
205-
--base main \
206-
--head ${{ steps.create-release.outputs.release_branch }} \
207-
--title "chore: update main with release v${{ steps.create-release.outputs.version }}" \
208-
--body "## 📦 Release Update
209-
210-
This PR updates main branch with:
211-
- ✅ Stable version numbers (beta suffix removed)
212-
- ✅ Updated package.json files
213-
- ✅ Release commit
214-
215-
**Note**: Changesets were already consumed in develop branch." \
216-
|| echo "PR creation failed"
217-
218-
# Also create PR to sync with develop
219-
gh pr create \
220-
--base develop \
221-
--head ${{ steps.create-release.outputs.release_branch }} \
222-
--title "chore: sync release v${{ steps.create-release.outputs.version }} to develop" \
223-
--body "## 🔄 Release Sync
224-
225-
This PR syncs the stable release back to develop:
226-
- ✅ Version alignment
227-
- ✅ Ensures develop has latest stable version
228-
229-
**Important**: Review carefully for any conflicts with ongoing development." \
230-
|| echo "Sync PR creation failed"
140+
echo "Release branch created: ${{ steps.create-release.outputs.release_branch }}"
141+
echo "The release branch workflow will handle:"
142+
echo "- Publishing to npm"
143+
echo "- Creating GitHub releases"
144+
echo "- Syncing with develop (auto-merge)"
145+
echo "- Creating PR to main"

packages/lazy-table-renderer/CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## 1.1.4
4+
5+
### Patch Changes
6+
7+
- dfb072a: test: 릴리스 워크플로우 개선 테스트
8+
9+
10+
## 1.1.4
11+
12+
### Patch Changes
13+
14+
- fe3926e: test: 하위 패키지만 업데이트 시 release 브랜치 동기화 워크플로우 테스트
15+
16+
17+
## 1.1.3
18+
19+
### Patch Changes
20+
21+
- 94f0f23: test: 하위 패키지만 업데이트하는 경우 릴리즈 브랜치 동기화 테스트
22+
23+
324
## 1.1.3
425

526
### Patch Changes

packages/lazy-table-renderer/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue-pivottable/lazy-table-renderer",
3-
"version": "1.1.3-beta.1750342216",
3+
"version": "1.1.4",
44
"type": "module",
55
"description": "",
66
"exports": {
@@ -43,7 +43,7 @@
4343
"license": "MIT",
4444
"scripts": {
4545
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --scope lazy-table-renderer",
46-
"clean": "rimraf lib",
46+
"clean": "rimraf dist",
4747
"build": "vite build",
4848
"lint": "eslint ."
4949
},

packages/plotly-renderer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue-pivottable/plotly-renderer",
3-
"version": "2.0.1-beta.1750342216",
3+
"version": "2.0.1-beta.1750342216-beta.1750371270-beta.1750372222-beta.1750374587",
44
"type": "module",
55
"exports": {
66
".": {
@@ -37,6 +37,7 @@
3737
"author": "Sumin, Lee <[email protected]>",
3838
"license": "MIT",
3939
"scripts": {
40+
"clean": "rimraf dist",
4041
"build": "vite build"
4142
},
4243
"dependencies": {

scripts/release-packages.cjs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ const packages = [
2525
{
2626
name: 'vue3-pivottable',
2727
path: '.',
28-
buildCmd: 'pnpm build',
28+
buildCmd: 'pnpm clean && pnpm build',
2929
publishCmd: 'pnpm changeset publish'
3030
},
3131
{
3232
name: '@vue-pivottable/plotly-renderer',
3333
path: './packages/plotly-renderer',
34-
buildCmd: 'pnpm --filter @vue-pivottable/plotly-renderer build',
34+
buildCmd: 'pnpm --filter @vue-pivottable/plotly-renderer clean && pnpm --filter @vue-pivottable/plotly-renderer build',
3535
publishCmd: 'pnpm changeset publish --filter @vue-pivottable/plotly-renderer',
3636
tokenEnv: 'NPM_TOKEN_SUMIN'
3737
},
3838
{
3939
name: '@vue-pivottable/lazy-table-renderer',
4040
path: './packages/lazy-table-renderer',
41-
buildCmd: 'pnpm --filter @vue-pivottable/lazy-table-renderer build',
41+
buildCmd: 'pnpm --filter @vue-pivottable/lazy-table-renderer clean && pnpm --filter @vue-pivottable/lazy-table-renderer build',
4242
publishCmd: 'pnpm changeset publish --filter @vue-pivottable/lazy-table-renderer',
4343
tokenEnv: 'NPM_TOKEN_SUMIN'
4444
}
@@ -62,6 +62,17 @@ async function releasePackages() {
6262
throw new Error(`Package directory not found: ${pkg.path}`);
6363
}
6464

65+
// Get package version
66+
const packageJsonPath = `${pkg.path}/package.json`;
67+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
68+
const currentVersion = packageJson.version;
69+
70+
// Skip if not a beta version (no changeset)
71+
if (!currentVersion.includes('-beta')) {
72+
log.info(`Skipping ${pkg.name} - no beta version (${currentVersion})`);
73+
continue;
74+
}
75+
6576
// Build package
6677
log.info(`Building ${pkg.name}...`);
6778
execSync(pkg.buildCmd, {

0 commit comments

Comments
 (0)