@rimori/client 2.3.0-next.9 → 2.4.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
name: Create Release Branch
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
base_branch:
|
|
7
|
+
description: 'Base branch to create release from'
|
|
8
|
+
required: true
|
|
9
|
+
default: 'main'
|
|
10
|
+
type: string
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
SLACK_CHANNEL_ID: C09FDPQ8XPB
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
create-release-branch:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: write
|
|
20
|
+
pull-requests: write
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
+
|
|
29
|
+
- name: Setup Node.js
|
|
30
|
+
uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: '20'
|
|
33
|
+
cache: 'yarn'
|
|
34
|
+
|
|
35
|
+
- name: Checkout base branch
|
|
36
|
+
run: |
|
|
37
|
+
BASE_BRANCH="${{ inputs.base_branch }}"
|
|
38
|
+
git checkout $BASE_BRANCH
|
|
39
|
+
git pull origin $BASE_BRANCH
|
|
40
|
+
|
|
41
|
+
- name: Get current version
|
|
42
|
+
id: get_version
|
|
43
|
+
run: |
|
|
44
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
45
|
+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
46
|
+
echo "Current version: $CURRENT_VERSION"
|
|
47
|
+
|
|
48
|
+
- name: Bump minor version
|
|
49
|
+
id: bump_version
|
|
50
|
+
run: |
|
|
51
|
+
CURRENT_VERSION="${{ steps.get_version.outputs.current_version }}"
|
|
52
|
+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
|
|
53
|
+
MAJOR=${VERSION_PARTS[0]}
|
|
54
|
+
MINOR=${VERSION_PARTS[1]}
|
|
55
|
+
PATCH=${VERSION_PARTS[2]}
|
|
56
|
+
|
|
57
|
+
NEW_MINOR=$((MINOR + 1))
|
|
58
|
+
NEW_VERSION="$MAJOR.$NEW_MINOR.0"
|
|
59
|
+
|
|
60
|
+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
61
|
+
echo "Bumping version from $CURRENT_VERSION to $NEW_VERSION"
|
|
62
|
+
|
|
63
|
+
- name: Get git commit messages
|
|
64
|
+
id: get_commits
|
|
65
|
+
run: |
|
|
66
|
+
BASE_BRANCH="${{ inputs.base_branch }}"
|
|
67
|
+
# Get commits since last tag, or last 20 commits if no tag exists
|
|
68
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
69
|
+
if [ -z "$LAST_TAG" ]; then
|
|
70
|
+
COMMITS=$(git log $BASE_BRANCH --pretty=format:"- %s (%h)" --no-merges | head -20)
|
|
71
|
+
else
|
|
72
|
+
COMMITS=$(git log $LAST_TAG..$BASE_BRANCH --pretty=format:"- %s (%h)" --no-merges)
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
if [ -z "$COMMITS" ]; then
|
|
76
|
+
COMMITS="- No commits found"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
echo "commits<<EOF" >> $GITHUB_OUTPUT
|
|
80
|
+
echo "$COMMITS" >> $GITHUB_OUTPUT
|
|
81
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
82
|
+
|
|
83
|
+
- name: Create release branch
|
|
84
|
+
run: |
|
|
85
|
+
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
86
|
+
BRANCH_NAME="release/v$NEW_VERSION"
|
|
87
|
+
git checkout -b $BRANCH_NAME
|
|
88
|
+
echo "Created branch: $BRANCH_NAME"
|
|
89
|
+
|
|
90
|
+
- name: Update package.json version
|
|
91
|
+
run: |
|
|
92
|
+
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
93
|
+
# Use node to update package.json to preserve formatting
|
|
94
|
+
node -e "const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); pkg.version = '$NEW_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
|
|
95
|
+
|
|
96
|
+
- name: Commit version bump
|
|
97
|
+
run: |
|
|
98
|
+
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
99
|
+
git config user.name "github-actions[bot]"
|
|
100
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
101
|
+
git add package.json
|
|
102
|
+
git commit -m "chore: bump version to $NEW_VERSION"
|
|
103
|
+
|
|
104
|
+
- name: Push release branch
|
|
105
|
+
run: |
|
|
106
|
+
BRANCH_NAME="release/v${{ steps.bump_version.outputs.new_version }}"
|
|
107
|
+
git push origin $BRANCH_NAME
|
|
108
|
+
|
|
109
|
+
- name: Create Pull Request
|
|
110
|
+
id: create_pr
|
|
111
|
+
env:
|
|
112
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
113
|
+
run: |
|
|
114
|
+
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}"
|
|
115
|
+
BRANCH_NAME="release/v$NEW_VERSION"
|
|
116
|
+
BASE_BRANCH="${{ inputs.base_branch }}"
|
|
117
|
+
COMMITS="${{ steps.get_commits.outputs.commits }}"
|
|
118
|
+
|
|
119
|
+
PR_BODY="## Release v${NEW_VERSION}
|
|
120
|
+
|
|
121
|
+
This PR bumps the version to **v${NEW_VERSION}**.
|
|
122
|
+
|
|
123
|
+
### Recent Changes
|
|
124
|
+
|
|
125
|
+
${COMMITS}
|
|
126
|
+
|
|
127
|
+
### Next Steps
|
|
128
|
+
- Review and merge this PR
|
|
129
|
+
- The release workflow will automatically create a prerelease when merged to main"
|
|
130
|
+
|
|
131
|
+
PR_URL=$(gh pr create \
|
|
132
|
+
--base "$BASE_BRANCH" \
|
|
133
|
+
--head "$BRANCH_NAME" \
|
|
134
|
+
--title "Release v$NEW_VERSION" \
|
|
135
|
+
--body "$PR_BODY")
|
|
136
|
+
|
|
137
|
+
PR_NUMBER=$(echo "$PR_URL" | grep -o '[0-9]*$')
|
|
138
|
+
echo "pull-request-number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
|
139
|
+
echo "pull-request-url=$PR_URL" >> $GITHUB_OUTPUT
|
|
140
|
+
echo "Created PR: $PR_URL"
|
|
141
|
+
|
|
142
|
+
- name: Send Slack notification - Success
|
|
143
|
+
if: success()
|
|
144
|
+
uses: slackapi/slack-github-action@v1.24.0
|
|
145
|
+
with:
|
|
146
|
+
channel-id: ${{ env.SLACK_CHANNEL_ID }}
|
|
147
|
+
payload: |
|
|
148
|
+
{
|
|
149
|
+
"text": "✅ Rimori-Client Release Branch Created",
|
|
150
|
+
"blocks": [
|
|
151
|
+
{
|
|
152
|
+
"type": "header",
|
|
153
|
+
"text": {
|
|
154
|
+
"type": "plain_text",
|
|
155
|
+
"text": "✅ rimori-client Release Branch Created"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"type": "section",
|
|
160
|
+
"fields": [
|
|
161
|
+
{
|
|
162
|
+
"type": "mrkdwn",
|
|
163
|
+
"text": "*Version:*\nv${{ steps.bump_version.outputs.new_version }}"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"type": "mrkdwn",
|
|
167
|
+
"text": "*Branch:*\n`release/v${{ steps.bump_version.outputs.new_version }}`"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "mrkdwn",
|
|
171
|
+
"text": "*PR:*\n#${{ steps.create_pr.outputs.pull-request-number }}"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"type": "section",
|
|
177
|
+
"text": {
|
|
178
|
+
"type": "mrkdwn",
|
|
179
|
+
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
env:
|
|
185
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
186
|
+
|
|
187
|
+
- name: Send Slack notification - Failure
|
|
188
|
+
if: failure()
|
|
189
|
+
uses: slackapi/slack-github-action@v1.24.0
|
|
190
|
+
with:
|
|
191
|
+
channel-id: ${{ env.SLACK_CHANNEL_ID }}
|
|
192
|
+
payload: |
|
|
193
|
+
{
|
|
194
|
+
"text": "❌ rimori-client Release Branch Creation Failed",
|
|
195
|
+
"blocks": [
|
|
196
|
+
{
|
|
197
|
+
"type": "header",
|
|
198
|
+
"text": {
|
|
199
|
+
"type": "plain_text",
|
|
200
|
+
"text": "❌ rimori-client Release Branch Creation Failed"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"type": "section",
|
|
205
|
+
"fields": [
|
|
206
|
+
{
|
|
207
|
+
"type": "mrkdwn",
|
|
208
|
+
"text": "*Version:*\nv${{ steps.bump_version.outputs.new_version }}"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"type": "mrkdwn",
|
|
212
|
+
"text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"type": "section",
|
|
218
|
+
"text": {
|
|
219
|
+
"type": "mrkdwn",
|
|
220
|
+
"text": "⚠️ *Action Required:* Review the pipeline failures and fix the issues before retrying."
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
env:
|
|
226
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
name: Release on Merge to Main
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- 'package.json'
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
SLACK_CHANNEL_ID: C09FDPQ8XPB
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
|
|
25
|
+
- name: Setup Node.js
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: '20'
|
|
29
|
+
cache: 'yarn'
|
|
30
|
+
|
|
31
|
+
- name: Get version from package.json
|
|
32
|
+
id: get_version
|
|
33
|
+
run: |
|
|
34
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
35
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
36
|
+
echo "Releasing version: $VERSION"
|
|
37
|
+
|
|
38
|
+
- name: Verify version bump
|
|
39
|
+
run: |
|
|
40
|
+
VERSION="${{ steps.get_version.outputs.version }}"
|
|
41
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
42
|
+
echo "Error: Invalid version format: $VERSION"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
echo "Version format is valid: $VERSION"
|
|
46
|
+
|
|
47
|
+
- name: Get changelog from commits
|
|
48
|
+
id: get_changelog
|
|
49
|
+
run: |
|
|
50
|
+
# Get commits since last tag
|
|
51
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
52
|
+
if [ -z "$LAST_TAG" ]; then
|
|
53
|
+
COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges | head -30)
|
|
54
|
+
else
|
|
55
|
+
COMMITS=$(git log $LAST_TAG..HEAD --pretty=format:"- %s (%h)" --no-merges)
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
if [ -z "$COMMITS" ]; then
|
|
59
|
+
COMMITS="- No commits found since last release"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
63
|
+
echo "$COMMITS" >> $GITHUB_OUTPUT
|
|
64
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
65
|
+
|
|
66
|
+
- name: Build project
|
|
67
|
+
run: |
|
|
68
|
+
yarn install --frozen-lockfile
|
|
69
|
+
yarn build
|
|
70
|
+
|
|
71
|
+
- name: Create GitHub Release (Prerelease)
|
|
72
|
+
uses: softprops/action-gh-release@v1
|
|
73
|
+
with:
|
|
74
|
+
tag_name: v${{ steps.get_version.outputs.version }}
|
|
75
|
+
name: Release v${{ steps.get_version.outputs.version }}
|
|
76
|
+
body: |
|
|
77
|
+
## Release v${{ steps.get_version.outputs.version }}
|
|
78
|
+
|
|
79
|
+
### Changes in this release
|
|
80
|
+
|
|
81
|
+
${{ steps.get_changelog.outputs.changelog }}
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
**Note:** This is a prerelease. It will be promoted to a stable release after testing.
|
|
86
|
+
prerelease: true
|
|
87
|
+
generate_release_notes: true
|
|
88
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
89
|
+
|
|
90
|
+
- name: Publish to npm (if configured)
|
|
91
|
+
id: npm_publish
|
|
92
|
+
if: secrets.NPM_TOKEN != ''
|
|
93
|
+
env:
|
|
94
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
95
|
+
run: |
|
|
96
|
+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
97
|
+
npm publish --tag prerelease || echo "npm publish skipped (may already exist)"
|
|
98
|
+
|
|
99
|
+
- name: Send Slack notification - Success
|
|
100
|
+
if: success()
|
|
101
|
+
uses: slackapi/slack-github-action@v1.24.0
|
|
102
|
+
with:
|
|
103
|
+
channel-id: ${{ env.SLACK_CHANNEL_ID }}
|
|
104
|
+
payload: |
|
|
105
|
+
{
|
|
106
|
+
"text": "✅ rimori-client Production Release",
|
|
107
|
+
"blocks": [
|
|
108
|
+
{
|
|
109
|
+
"type": "header",
|
|
110
|
+
"text": {
|
|
111
|
+
"type": "plain_text",
|
|
112
|
+
"text": "✅ rimori-client Production Release Succeeded"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"type": "section",
|
|
117
|
+
"fields": [
|
|
118
|
+
{
|
|
119
|
+
"type": "mrkdwn",
|
|
120
|
+
"text": "*Version:*\nv${{ steps.get_version.outputs.version }}"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "mrkdwn",
|
|
124
|
+
"text": "*Type:*\nPrerelease"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"type": "mrkdwn",
|
|
128
|
+
"text": "*Branch:*\nmain"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "section",
|
|
134
|
+
"text": {
|
|
135
|
+
"type": "mrkdwn",
|
|
136
|
+
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
env:
|
|
142
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
143
|
+
|
|
144
|
+
- name: Send Slack notification - Failure
|
|
145
|
+
if: failure()
|
|
146
|
+
uses: slackapi/slack-github-action@v1.24.0
|
|
147
|
+
with:
|
|
148
|
+
channel-id: ${{ env.SLACK_CHANNEL_ID }}
|
|
149
|
+
payload: |
|
|
150
|
+
{
|
|
151
|
+
"text": "❌ rimori-client Production Release Failed",
|
|
152
|
+
"blocks": [
|
|
153
|
+
{
|
|
154
|
+
"type": "header",
|
|
155
|
+
"text": {
|
|
156
|
+
"type": "plain_text",
|
|
157
|
+
"text": "❌ rimori-client Production Release Failed"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "section",
|
|
162
|
+
"fields": [
|
|
163
|
+
{
|
|
164
|
+
"type": "mrkdwn",
|
|
165
|
+
"text": "*Version:*\nv${{ steps.get_version.outputs.version }}"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"type": "mrkdwn",
|
|
169
|
+
"text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"type": "section",
|
|
175
|
+
"text": {
|
|
176
|
+
"type": "mrkdwn",
|
|
177
|
+
"text": "⚠️ *Action Required:* Review the pipeline failures and fix the issues before retrying the release."
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
env:
|
|
183
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|