-
Notifications
You must be signed in to change notification settings - Fork 13
211 lines (193 loc) · 9.63 KB
/
Copy pathpre-release.yml
File metadata and controls
211 lines (193 loc) · 9.63 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Pre-release updates
on:
workflow_dispatch:
inputs:
restateVersion:
description: "Restate version (without prepending v). The Restate repository must have the tag already!"
required: false
type: string
sdkTypescriptVersion:
description: "sdk-typescript version (without prepending v)."
required: false
type: string
sdkPythonVersion:
description: "sdk-python version (without prepending v)."
required: false
type: string
sdkJavaVersion:
description: "sdk-java version (without prepending v)."
required: false
type: string
sdkGoVersion:
description: "sdk-go version (WITH the prepending v)."
required: false
type: string
sdkRustVersion:
description: 'sdk-rust version (without prepending v). Leave empty if you do not want to update it.'
required: false
type: string
jobs:
updates:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout documentation
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Checkout Restate
uses: actions/checkout@v3
if: ${{ inputs.restateVersion != '' }}
with:
repository: restatedev/restate
ref: v${{ inputs.restateVersion }}
path: temp-restate
# We need rust, protoc and just to compile the runtime to generate the docs
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install protoc
uses: ./.github/actions/install-protoc
- name: Setup just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run the runtime generate script
if: ${{ inputs.restateVersion != '' }}
run: |
./.tools/generate.sh temp-restate
- name: Validate OpenAPI schema
if: ${{ inputs.restateVersion != '' }}
run: |
npx @mintlify/cli@latest openapi-check docs/schemas/openapi-admin.json
- name: Parse Restate version
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
if: ${{ inputs.restateVersion != '' }}
with:
input_string: ${{ inputs.restateVersion }}
# Update the doc config file
- name: Update custom-variables.mdx with new Restate version
if: ${{ inputs.restateVersion != '' }}
run: sed -i 's/RESTATE_VERSION = "[0-9A-Za-z.-]*"/RESTATE_VERSION = "'${{ format('{0}.{1}', steps.semver_parser.outputs.major, steps.semver_parser.outputs.minor) }}'"/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new TS sdk version
if: ${{ inputs.sdkTypescriptVersion != '' }}
run: sed -i 's/TYPESCRIPT_SDK_VERSION = "[0-9A-Za-z.-]*"/TYPESCRIPT_SDK_VERSION = "'${{ inputs.sdkTypescriptVersion }}'"/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Python sdk version
if: ${{ inputs.sdkPythonVersion != '' }}
run: sed -i 's/PYTHON_SDK_VERSION = "[0-9A-Za-z.-]*"/PYTHON_SDK_VERSION = "'${{ inputs.sdkPythonVersion }}'"/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Java sdk version
if: ${{ inputs.sdkJavaVersion != '' }}
run: sed -i 's/JAVA_SDK_VERSION = "[0-9A-Za-z.-]*"/JAVA_SDK_VERSION = "'${{ inputs.sdkJavaVersion }}'"/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Go sdk version
if: ${{ inputs.sdkGoVersion != '' }}
run: sed -i 's/GO_SDK_VERSION = "[0-9A-Za-z.-]*"/GO_SDK_VERSION = "'${{ inputs.sdkGoVersion }}'"/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Rust sdk version
if: ${{ inputs.sdkRustVersion != '' }}
run: sed -i 's/RUST_SDK_VERSION = "[0-9A-Za-z.-]*"/RUST_SDK_VERSION = "'${{ inputs.sdkRustVersion }}'"/' "docs/snippets/custom-variables.mdx"
# Upgrade TS code snippets if new version is provided
- name: Upgrade TS Restate SDK
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK Clients
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-clients@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK ZOD
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-zod@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK Testcontainers
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-testcontainers@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restaet SDK OpenTelemetry
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-opentelemetry@^${{ inputs.sdkTypescriptVersion }}
# Test if TS code snippets compile and build
- name: Compile TypeScript code snippets
run: npm install --prefix snippets/ts && npm run build --prefix snippets/ts
# Upgrade Python code snippets if new version is provided
# Test if Python code snippets compile
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Bump Python SDK version
if: github.event.inputs.sdkPythonVersion != ''
run: |
cd snippets/python
uv add "restate_sdk[serde]==${{ inputs.sdkPythonVersion }}"
- name: Test Python
run: |
cd snippets/python
uv sync --locked --all-extras --dev
uv add --dev mypy
uv run mypy .
# Bump Java SDK
# This automatically bumps kotlin as well
- name: Bump Java SDK version in code snippets
if: github.event.inputs.sdkJavaVersion != ''
run: sed -i "s/^restate = '[^']*'/restate = '${{ inputs.sdkJavaVersion }}'/" snippets/java/gradle/libs.versions.toml
- uses: actions/setup-java@v4
if: ${{ inputs.sdkJavaVersion != '' }}
with:
distribution: "temurin"
java-version: "21"
- name: Setup Gradle
if: ${{ inputs.sdkJavaVersion != '' }}
uses: gradle/actions/setup-gradle@v3
- name: Test Java code snippets
if: ${{ inputs.sdkJavaVersion != '' }}
run: gradle -p snippets/java check
- name: Test Kotlin code snippets
if: ${{ inputs.sdkJavaVersion != '' }}
run: gradle -p snippets/kotlin check
# Upgrade Go code snippets if new version is provided
- uses: actions/setup-go@v5
if: ${{ inputs.sdkGoVersion != '' }}
with:
go-version: "1.22"
- name: Bump sdk-go
if: ${{ inputs.sdkGoVersion != '' }}
run: |
cd snippets/go
go get github.com/restatedev/sdk-go@v${{ inputs.sdkGoVersion }}
go mod tidy
- name: Test Go code snippets
if: ${{ inputs.sdkGoVersion != '' }}
run: |
cd snippets/go
go test ./...
# Bump Rust SDK
- name: Install Rust toolchain
if: ${{ inputs.sdkRustVersion != '' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
rustflags: ""
- name: Bump sdk-rust
if: ${{ inputs.sdkRustVersion != '' }}
run: |
sed -i 's/^restate-sdk = { version = "[^"]*"/restate-sdk = { version = "${{ inputs.sdkRustVersion }}"/' snippets/rust/Cargo.toml
cargo update --manifest-path ./snippets/rust/Cargo.toml
- name: Run Rust tests
if: ${{ inputs.sdkRustVersion != '' }}
run: cargo clippy --manifest-path ./snippets/rust/Cargo.toml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: "[GithubActions] Update documentation ${{ inputs.restateVersion != '' && format('Restate {0}, ', inputs.restateVersion) }} ${{ inputs.sdkTypescriptVersion != '' && format('SDK-Typescript {0}, ', inputs.sdkTypescriptVersion) }} ${{ inputs.sdkJavaVersion != '' && format('SDK-Java {0}, ', inputs.sdkJavaVersion) }} ${{ inputs.sdkPythonVersion != '' && format('SDK-Python {0}, ', inputs.sdkPythonVersion) }} ${{ inputs.sdkGoVersion != '' && format('SDK-Go {0}, ', inputs.sdkGoVersion) }} ${{ inputs.sdkRustVersion != '' && format('SDK-Rust {0}, ', inputs.sdkRustVersion) }}"
commit-message: "Update documentation: ${{ inputs.restateVersion != '' && format('\n* Bump Restate to {0}', inputs.restateVersion) }} ${{ inputs.sdkTypescriptVersion != '' && format('\n* Bump SDK-Typescript to {0} ', inputs.sdkTypescriptVersion) }} ${{ inputs.sdkJavaVersion != '' && format('\n* Bump SDK-Java to {0} ', inputs.sdkJavaVersion) }} ${{ inputs.sdkPythonVersion != '' && format('SDK-Python {0}, ', inputs.sdkPythonVersion) }} ${{ inputs.sdkGoVersion != '' && format('SDK-Go {0}, ', inputs.sdkGoVersion) }} ${{ inputs.sdkRustVersion != '' && format('SDK-Rust {0}, ', inputs.sdkRustVersion) }}"
add-paths: |
docs/snippets/custom-variables.mdx
docs/schemas/*
docs/references/*
snippets/ts/package.json
snippets/ts/package-lock.json
snippets/java/gradle/libs.versions.toml
snippets/python/pyproject.toml
snippets/go/go.mod
snippets/go/go.sum
snippets/rust/Cargo.lock
snippets/rust/Cargo.toml