Skip to content

Commit 2856130

Browse files
chore: release packages (#4)
* chore: リリースワークフローをdevelop/release分離構成に変更 * fix: changeset versionにGITHUB_TOKENを渡す * fix: PR bodyをファイル経由で渡しバッククォートのエスケープ問題を修正 * chore: release packages --------- Co-authored-by: r74tech <r74tech@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 5e5a7de commit 2856130

File tree

12 files changed

+125
-25
lines changed

12 files changed

+125
-25
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"access": "public",
1111
"baseBranch": "develop",
1212
"updateInternalDependencies": "patch",
13-
"ignore": []
13+
"ignore": ["@wdmock/*"]
1414
}

.changeset/witty-lands-prove.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [release]
6+
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: oven-sh/setup-bun@v2
19+
with:
20+
bun-version: latest
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: "22"
25+
registry-url: "https://registry.npmjs.org"
26+
27+
- run: bun install --frozen-lockfile
28+
29+
- run: bun run build
30+
31+
- name: Publish to npm
32+
run: bun changeset publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Push tags
38+
run: git push --follow-tags

.github/workflows/release.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
branches: [release]
5+
branches: [develop]
66

77
concurrency: ${{ github.workflow }}-${{ github.ref }}
88

@@ -12,26 +12,58 @@ jobs:
1212
permissions:
1313
contents: write
1414
pull-requests: write
15-
id-token: write
1615
steps:
1716
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
1819

1920
- uses: oven-sh/setup-bun@v2
2021
with:
2122
bun-version: latest
2223

2324
- run: bun install --frozen-lockfile
2425

25-
- run: bun run build
26+
- name: Check for changesets
27+
id: check
28+
run: |
29+
if ls .changeset/*.md 2>/dev/null | grep -v README.md | head -1 > /dev/null 2>&1; then
30+
echo "has_changesets=true" >> "$GITHUB_OUTPUT"
31+
else
32+
echo "has_changesets=false" >> "$GITHUB_OUTPUT"
33+
fi
2634
27-
- name: Create Release Pull Request or Publish
28-
id: changesets
29-
uses: changesets/action@v1
30-
with:
31-
version: bun changeset version
32-
publish: bun changeset publish
33-
title: "chore: release packages"
34-
commit: "chore: release packages"
35+
- name: Version packages
36+
if: steps.check.outputs.has_changesets == 'true'
37+
run: |
38+
git config user.name "github-actions[bot]"
39+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+
bun changeset version
41+
git add .
42+
git commit -m "chore: release packages" || echo "No changes to commit"
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Generate PR body
47+
if: steps.check.outputs.has_changesets == 'true'
48+
run: |
49+
for changelog in $(git diff HEAD~1 --name-only | grep 'CHANGELOG.md$'); do
50+
cat "$changelog"
51+
echo ""
52+
done > /tmp/pr-body.md
53+
54+
- name: Create or update release PR
55+
if: steps.check.outputs.has_changesets == 'true'
56+
run: |
57+
git push origin HEAD:changeset-release/release --force
58+
EXISTING_PR=$(gh pr list --base release --head changeset-release/release --json number --jq '.[0].number')
59+
if [ -n "$EXISTING_PR" ]; then
60+
gh pr edit "$EXISTING_PR" --body-file /tmp/pr-body.md
61+
else
62+
gh pr create \
63+
--base release \
64+
--head changeset-release/release \
65+
--title "chore: release packages" \
66+
--body-file /tmp/pr-body.md
67+
fi
3568
env:
3669
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

packages/ast/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# @wdpr/ast
2+
3+
## 1.0.0
4+
5+
### Major Changes
6+
7+
- [`5e5a7de`](https://github.com/r74tech/wdpr/commit/5e5a7def04c116fdf90419684b5c773716ca4ed4) Thanks [@r74tech](https://github.com/r74tech)! - Initial release of WDPR packages: parser, renderer, AST definitions, and runtime

packages/ast/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdpr/ast",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "AST types for Wikidot markup",
55
"keywords": [
66
"ast",

packages/parser/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @wdpr/parser
2+
3+
## 1.0.0
4+
5+
### Major Changes
6+
7+
- [`5e5a7de`](https://github.com/r74tech/wdpr/commit/5e5a7def04c116fdf90419684b5c773716ca4ed4) Thanks [@r74tech](https://github.com/r74tech)! - Initial release of WDPR packages: parser, renderer, AST definitions, and runtime
8+
9+
### Patch Changes
10+
11+
- Updated dependencies [[`5e5a7de`](https://github.com/r74tech/wdpr/commit/5e5a7def04c116fdf90419684b5c773716ca4ed4)]:
12+
- @wdpr/ast@1.0.0

packages/parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdpr/parser",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "Parser for Wikidot markup",
55
"keywords": [
66
"ast",

packages/render/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @wdpr/render
2+
3+
## 1.0.0
4+
5+
### Major Changes
6+
7+
- [`5e5a7de`](https://github.com/r74tech/wdpr/commit/5e5a7def04c116fdf90419684b5c773716ca4ed4) Thanks [@r74tech](https://github.com/r74tech)! - Initial release of WDPR packages: parser, renderer, AST definitions, and runtime
8+
9+
### Patch Changes
10+
11+
- Updated dependencies [[`5e5a7de`](https://github.com/r74tech/wdpr/commit/5e5a7def04c116fdf90419684b5c773716ca4ed4)]:
12+
- @wdpr/ast@1.0.0

packages/render/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdpr/render",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "HTML renderer for Wikidot markup",
55
"keywords": [
66
"html",

0 commit comments

Comments
 (0)