-
Notifications
You must be signed in to change notification settings - Fork 7
206 lines (181 loc) · 7.95 KB
/
pre-release.yml
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
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
jobs:
updates:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout documentation
uses: actions/checkout@v3
- 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 }}
# We need java and gradle for the javadocs
- 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: Run the runtime generate script
if: ${{ inputs.restateVersion != '' }}
run: |
./tools/generate.sh temp-restate
- 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 restate.config.json with new runtime version
uses: jossef/[email protected]
if: ${{ inputs.restateVersion != '' }}
with:
file: restate.config.json
field: RESTATE_VERSION
# Drop patch version to generate major.minor format
value: ${{ format('{0}.{1}', steps.semver_parser.outputs.major, steps.semver_parser.outputs.minor) }}
- name: Update restate.config.json with new TS sdk version
uses: jossef/[email protected]
if: ${{ inputs.sdkTypescriptVersion != '' }}
with:
file: restate.config.json
field: TYPESCRIPT_SDK_VERSION
value: ${{ inputs.sdkTypescriptVersion }}
- name: Update restate.config.json with new Python sdk version
uses: jossef/[email protected]
if: ${{ inputs.sdkPythonVersion != '' }}
with:
file: restate.config.json
field: PYTHON_SDK_VERSION
value: ${{ inputs.sdkPythonVersion }}
- name: Update restate.config.json with new Java sdk version
uses: jossef/[email protected]
if: ${{ inputs.sdkJavaVersion != '' }}
with:
file: restate.config.json
field: JAVA_SDK_VERSION
value: ${{ inputs.sdkJavaVersion }}
# Upgrade TS code snippets if new version is provided
- name: Upgrade TS Restate SDK
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix code_snippets/ts install @restatedev/restate-sdk@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK Clients
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix code_snippets/ts install @restatedev/restate-sdk-clients@^${{ inputs.sdkTypescriptVersion }}
# Test if TS code snippets compile and build
- name: Compile TypeScript code snippets
run: npm install --prefix code_snippets/ts && npm run build --prefix code_snippets/ts
# Upgrade Python code snippets if new version is provided
- name: Upgrade Python Restate SDK
if: github.event.inputs.sdkPythonVersion != ''
run: sed -i 's/restate_sdk==[0-9A-Za-z.-]*/restate_sdk=="${{ inputs.sdkPythonVersion }}"/' "code_snippets/python/requirements.txt"
# Test if Python code snippets compile
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies and check Python code snippets
run: |
cd code_snippets/python
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install mypy
python3 -m mypy .
deactivate
# Upgrade Java code snippets if new version is provided
- name: Find and replace restateVersion in build.gradle.kts for Java code snippets
if: github.event.inputs.sdkJavaVersion != ''
run: sed -i 's/val restateVersion = "[0-9A-Z.-]*"/val restateVersion = "${{ inputs.sdkJavaVersion }}"/' code_snippets/java/build.gradle.kts
# Upgrade Kotlin code snippets if new version is provided
- name: Find and replace restateVersion in build.gradle.kts for Kotlin code snippets
if: github.event.inputs.sdkJavaVersion != ''
run: sed -i 's/val restateVersion = "[0-9A-Z.-]*"/val restateVersion = "${{ inputs.sdkJavaVersion }}"/' code_snippets/kotlin/build.gradle.kts
# Check Java code snippets
- name: Test Java code snippets
if: ${{ inputs.sdkJavaVersion != '' }}
run: gradle -p code_snippets/java check
# Check Kotlin code snippets
- name: Test Kotlin code snippets
if: ${{ inputs.sdkJavaVersion != '' }}
run: gradle -p code_snippets/kotlin check
# Checkout SDK java for the javadocs/ktdocs
- name: Checkout SDK-Java
uses: actions/checkout@v3
if: ${{ inputs.sdkJavaVersion != '' }}
with:
repository: restatedev/sdk-java
ref: v${{ inputs.sdkJavaVersion }}
path: temp-sdk-java
# Setup Go
- uses: actions/setup-go@v5
if: ${{ inputs.sdkGoVersion != '' }}
with:
go-version: "1.21"
# Upgrade Go code snippets if new version is provided
- name: Bump sdk-go
if: github.event.inputs.sdkGoVersion != ''
working-directory: code_snippets/go
run: |
go get github.com/restatedev/sdk-go@${{ github.event.inputs.sdkGoVersion }}
go mod tidy
# Check Go code snippets
- name: Test Go code snippets
working-directory: code_snippets/go
run: go test ./...
- name: Run the runtime generate script
if: ${{ inputs.sdkJavaVersion != '' }}
run: |
./tools/build_sdk_java_docs.sh temp-sdk-java
- 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) }}"
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) }}"
add-paths: |
restate.config.json
static/schemas/*
static/javadocs/*
static/ktdocs/*
docs/references/*