-
Notifications
You must be signed in to change notification settings - Fork 518
153 lines (130 loc) · 5.26 KB
/
01-create-release-branch.yml
File metadata and controls
153 lines (130 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: 01 - create release branch
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch:
inputs:
release-type:
description: "release type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
jobs:
bump-version:
name: Bump version and create PR
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.bump_versions.outputs.NEW_VERSION }}
versions_match: ${{ steps.bump_versions.outputs.VERSIONS_MATCH }}
pr_number: ${{ steps.create-pr.outputs.pull-request-number }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install uv
run: |
python -m pip install "uv==0.11.9"
- name: Bump versions and compare
id: bump_versions
run: |
BUMP_TYPE=${{ inputs.release-type }}
echo "Bumping versions to $BUMP_TYPE"
npm install semver -g
cd web
pnpm version $BUMP_TYPE
WEB_VERSION=$(pnpm pkg get version | tr -d '"')
cd ee
current_version=$(pnpm pkg get version | awk -F': ' '/[0-9]+\.[0-9]+\.[0-9]+/ {print $2}' | tr -d '"')
new_version=$(npx semver "$current_version" -i $BUMP_TYPE)
pnpm pkg set version="$new_version"
EE_VERSION=$new_version
cd ..
cd oss
current_version=$(pnpm pkg get version | awk -F': ' '/[0-9]+\.[0-9]+\.[0-9]+/ {print $2}' | tr -d '"')
new_version=$(npx semver "$current_version" -i $BUMP_TYPE)
pnpm pkg set version="$new_version"
OSS_VERSION=$new_version
cd ..
cd packages/agenta-api-client
current_version=$(pnpm pkg get version | awk -F': ' '/[0-9]+\.[0-9]+\.[0-9]+/ {print $2}' | tr -d '"')
new_version=$(npx semver "$current_version" -i $BUMP_TYPE)
pnpm pkg set version="$new_version"
TS_CLIENT_VERSION=$new_version
cd ../..
cd ..
cd clients/python
PY_CLIENT_VERSION=$(uv version --bump "$BUMP_TYPE" --short)
cd ../..
cd sdks/python
PY_SDK_VERSION=$(uv version --bump "$BUMP_TYPE" --short)
cd ../..
cd api
API_VERSION=$(uv version --bump "$BUMP_TYPE" --short)
cd ..
cd services
SERVICES_VERSION=$(uv version --bump "$BUMP_TYPE" --short)
cd ..
WEB_VERSION=$(echo "$WEB_VERSION" | tr -d '[:space:]')
EE_VERSION=$(echo "$EE_VERSION" | tr -d '[:space:]')
OSS_VERSION=$(echo "$OSS_VERSION" | tr -d '[:space:]')
TS_CLIENT_VERSION=$(echo "$TS_CLIENT_VERSION" | tr -d '[:space:]')
PY_CLIENT_VERSION=$(echo "$PY_CLIENT_VERSION" | tr -d '[:space:]')
PY_SDK_VERSION=$(echo "$PY_SDK_VERSION" | tr -d '[:space:]')
API_VERSION=$(echo "$API_VERSION" | tr -d '[:space:]')
SERVICES_VERSION=$(echo "$SERVICES_VERSION" | tr -d '[:space:]')
echo "WEB_VERSION='$WEB_VERSION'"
echo "EE_VERSION='$EE_VERSION'"
echo "OSS_VERSION='$OSS_VERSION'"
echo "TS_CLIENT_VERSION='$TS_CLIENT_VERSION'"
echo "PY_CLIENT_VERSION='$PY_CLIENT_VERSION'"
echo "PY_SDK_VERSION='$PY_SDK_VERSION'"
echo "API_VERSION='$API_VERSION'"
echo "SERVICES_VERSION='$SERVICES_VERSION'"
if [ "$EE_VERSION" = "$OSS_VERSION" ] && [ "$OSS_VERSION" = "$WEB_VERSION" ] && [ "$WEB_VERSION" = "$TS_CLIENT_VERSION" ] && [ "$TS_CLIENT_VERSION" = "$PY_CLIENT_VERSION" ] && [ "$PY_CLIENT_VERSION" = "$PY_SDK_VERSION" ] && [ "$PY_SDK_VERSION" = "$API_VERSION" ] && [ "$API_VERSION" = "$SERVICES_VERSION" ]; then
echo "VERSIONS_MATCH=true" >> $GITHUB_OUTPUT
echo "NEW_VERSION=$WEB_VERSION" >> $GITHUB_OUTPUT
else
echo "VERSIONS_MATCH=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.bump_versions.outputs.VERSIONS_MATCH == 'true'
uses: peter-evans/create-pull-request@v6
with:
commit-message: v${{ steps.bump_versions.outputs.NEW_VERSION }}
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
branch: release/v${{ steps.bump_versions.outputs.NEW_VERSION }}
delete-branch: true
title: "[release] v${{ steps.bump_versions.outputs.NEW_VERSION }}"
body: |
New version v${{ steps.bump_versions.outputs.NEW_VERSION }} in
- (web)
- web/oss
- web/ee
- clients/typescript
- clients/python
- sdks/python
- api
- services
- name: Fail if versions don't match
if: steps.bump_versions.outputs.VERSIONS_MATCH != 'true'
run: |
echo "Versions in the three folders do not match. Please check and update manually."
exit 1