-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (139 loc) · 4.79 KB
/
release.yml
File metadata and controls
159 lines (139 loc) · 4.79 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
154
155
156
157
158
159
name: Release Prepare
on:
workflow_dispatch:
inputs:
nacos_tag:
description: 'Nacos release tag (e.g. 3.2.0)'
required: true
version:
description: 'Package version (defaults to nacos_tag)'
required: false
dry_run:
description: 'Dry run (skip PR creation)'
type: boolean
default: true
concurrency:
group: release
cancel-in-progress: false
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Determine version
id: version
run: |
VER="${{ inputs.version }}"
if [ -z "$VER" ]; then
VER="${{ inputs.nacos_tag }}"
fi
echo "value=$VER" >> "$GITHUB_OUTPUT"
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
path: nacos-sdk-proto
token: ${{ steps.app-token.outputs.token }}
# --- Java toolchain ---
- uses: actions/checkout@v4
with:
repository: alibaba/nacos
ref: ${{ inputs.nacos_tag }}
path: nacos
fetch-depth: 1
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Build nacos-api
run: cd nacos && mvn install -pl api -am -DskipTests -Drat.skip=true -q
- name: Link nacos for Makefile
run: ln -s "$GITHUB_WORKSPACE/nacos" nacos-sdk-proto/.nacos
# --- protoc ---
- name: Install protoc
run: |
PROTOC_VERSION=28.3
curl -fsSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip -o protoc.zip
sudo unzip -o protoc.zip -d /usr/local bin/protoc 'include/*'
rm protoc.zip
protoc --version
# --- Go toolchain ---
- uses: actions/setup-go@v5
with:
go-version-file: nacos-sdk-proto/go/go.mod
cache-dependency-path: nacos-sdk-proto/go/go.sum
- name: Install Go protoc plugins
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# --- Python toolchain ---
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install grpcio-tools
run: pip install grpcio-tools
# --- Node.js toolchain ---
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install ts-proto
run: cd nacos-sdk-proto && npm install
# --- Generate and verify ---
- name: Generate and verify
run: |
cd nacos-sdk-proto
make clean
make generate-proto
make generate
make verify-build
- name: Update VERSION
run: |
SHA=$(cd nacos && git rev-parse HEAD)
cat > nacos-sdk-proto/proto/VERSION << VEOF
{
"source": "tag",
"nacos_ref": "${{ inputs.nacos_tag }}",
"nacos_commit": "$SHA",
"generated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
}
VEOF
- name: Update package versions
run: |
cd nacos-sdk-proto
VER="${{ steps.version.outputs.value }}"
sed -i "s/version = \".*\"/version = \"${VER}\"/" python/pyproject.toml
sed -i "s/\"version\": \".*\"/\"version\": \"${VER}\"/" nodejs/package.json
echo "Updated package versions to ${VER}"
- name: Create release PR
if: ${{ !inputs.dry_run }}
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
cd nacos-sdk-proto
git config user.name "nacos-sdk-proto-bot[bot]"
git config user.email "nacos-sdk-proto-bot[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "No changes detected, skipping PR."
exit 0
fi
VER="${{ steps.version.outputs.value }}"
BRANCH="release/v${VER}"
git checkout -b "$BRANCH"
git commit -m "release: v${VER} (nacos ${{ inputs.nacos_tag }})"
git push origin "$BRANCH"
gh pr create \
--title "release: v${VER} (nacos ${{ inputs.nacos_tag }})" \
--body "Update VERSION and package versions for v${VER} release. Merging this PR will trigger package publishing."
- name: Dry-run report
if: ${{ inputs.dry_run }}
run: |
cd nacos-sdk-proto
echo "=== Changes that would be committed ==="
git diff --cached --stat