Skip to content

Commit e7b8f50

Browse files
New release process
* Now releasing examples follows a similar flow to the documentation repo * There is a pre-release workflow that performs all the sdk updates * Then the release workflow zips the sdk-java and typescript lambda greeter examples, and adds them to the GH release artifacts
1 parent 1a5b0ca commit e7b8f50

File tree

5 files changed

+177
-28
lines changed

5 files changed

+177
-28
lines changed

.github/workflows/pre-release.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Pre-release updates
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
sdkTypescriptVersion:
7+
description: 'sdk-typescript version (without prepending v). Leave empty if you don't need to update it.'
8+
required: false
9+
type: string
10+
sdkJavaVersion:
11+
description: 'sdk-java version (without prepending v). Leave empty if you don't need to update it.'
12+
required: false
13+
type: string
14+
15+
jobs:
16+
updates:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 20
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
# Setup node
25+
- uses: actions/setup-node@v3
26+
if: github.event.inputs.sdkTypescriptVersion != ''
27+
with:
28+
node-version: "19.x"
29+
registry-url: 'https://registry.npmjs.org'
30+
31+
# Bump sdk version in node examples and run checks
32+
- name: Run npm updates
33+
if: github.event.inputs.sdkTypescriptVersion != ''
34+
run: npm --prefix typescript install @restatedev/restate-sdk@^${{ inputs.sdkTypescriptVersion }} --workspaces
35+
- name: Check npm examples compile correctly
36+
if: github.event.inputs.sdkTypescriptVersion != ''
37+
run: npm --prefix typescript run verify --workspaces
38+
39+
# Setup Java
40+
- uses: actions/setup-java@v3
41+
if: github.event.inputs.sdkJavaVersion != ''
42+
with:
43+
distribution: 'temurin'
44+
java-version: '17'
45+
46+
# Bump sdk version in java examples and run checks
47+
- name: Find and replace restateVersion in build.gradle.kts
48+
if: github.event.inputs.sdkJavaVersion != ''
49+
run: for jvmDir in java-blocking-http java-blocking-lambda kotlin-http kotlin-lambda; do sed -i 's/val restateVersion = "[0-9A-Z.-]*"/val restateVersion = "${{ inputs.sdkJavaVersion }}"/' jvm/$jvmDir/build.gradle.kts; done
50+
- name: Test jvm/java-blocking-http
51+
if: github.event.inputs.sdkJavaVersion != ''
52+
uses: gradle/gradle-build-action@v2
53+
with:
54+
arguments: check
55+
build-root-directory: jvm/java-blocking-http
56+
- name: Test jvm/java-blocking-lambda
57+
if: github.event.inputs.sdkJavaVersion != ''
58+
uses: gradle/gradle-build-action@v2
59+
with:
60+
arguments: check
61+
build-root-directory: jvm/java-blocking-lambda
62+
- name: Test jvm/kotlin-http
63+
if: github.event.inputs.sdkJavaVersion != ''
64+
uses: gradle/gradle-build-action@v2
65+
with:
66+
arguments: check
67+
build-root-directory: jvm/kotlin-http
68+
- name: Test jvm/kotlin-lambda
69+
if: github.event.inputs.sdkJavaVersion != ''
70+
uses: gradle/gradle-build-action@v2
71+
with:
72+
arguments: check
73+
build-root-directory: jvm/kotlin-lambda
74+
75+
- name: Create Pull Request
76+
uses: peter-evans/create-pull-request@v5
77+
with:
78+
title: "[GithubActions] Update Restate SDK-Typescript '${{ inputs.sdkTypescriptVersion }}' SDK-Java '${{ inputs.sdkJavaVersion }}'"
79+
commit-message: "[GithubActions] Update Restate SDK-Typescript '${{ inputs.sdkTypescriptVersion }}' SDK-Java '${{ inputs.sdkJavaVersion }}'"
80+
add-paths: |
81+
**/package.json
82+
**/package-lock.json
83+
**/build.gradle.kts

.github/workflows/release.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Create new release
2+
3+
on:
4+
push:
5+
tags:
6+
- v**
7+
8+
jobs:
9+
publish-release:
10+
name: Publish release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Prepare zip files
17+
run: ./scripts/prepare_examples_zip.sh
18+
19+
- name: Create release
20+
uses: softprops/action-gh-release@v1
21+
with:
22+
# create a draft release which needs manual approval
23+
draft: true
24+
files: |
25+
typescript-lambda-greeter.zip
26+
jvm-java-blocking-http.zip
27+
jvm-java-blocking-lambda.zip
28+
jvm-kotlin-http.zip
29+
jvm-kotlin-lambda.zip

.github/workflows/test.yml

+40-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,44 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
build:
10+
build-jvm:
11+
# prevent from running on forks
12+
if: github.repository_owner == 'restatedev'
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
jvm-version: [ 17 ]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Use JVM ${{ matrix.jvm-version }}
22+
uses: actions/setup-java@v3
23+
with:
24+
distribution: 'temurin'
25+
java-version: ${{ matrix.jvm-version }}
26+
27+
- name: Test jvm/java-blocking-http
28+
uses: gradle/gradle-build-action@v2
29+
with:
30+
arguments: check
31+
build-root-directory: jvm/java-blocking-http
32+
- name: Test jvm/java-blocking-lambda
33+
uses: gradle/gradle-build-action@v2
34+
with:
35+
arguments: check
36+
build-root-directory: jvm/java-blocking-lambda
37+
- name: Test jvm/kotlin-http
38+
uses: gradle/gradle-build-action@v2
39+
with:
40+
arguments: check
41+
build-root-directory: jvm/kotlin-http
42+
- name: Test jvm/kotlin-lambda
43+
uses: gradle/gradle-build-action@v2
44+
with:
45+
arguments: check
46+
build-root-directory: jvm/kotlin-lambda
47+
build-ts:
1148
# prevent from running on forks
1249
if: github.repository_owner == 'restatedev'
1350
runs-on: ubuntu-latest
@@ -17,11 +54,13 @@ jobs:
1754

1855
steps:
1956
- uses: actions/checkout@v3
57+
2058
- uses: bufbuild/buf-setup-action@v1
2159
- name: Use Node.js ${{ matrix.node-version }}
2260
uses: actions/setup-node@v3
2361
with:
2462
node-version: ${{ matrix.node-version }}
2563
registry-url: 'https://registry.npmjs.org'
64+
2665
- run: npm ci --prefix typescript
2766
- run: npm run --prefix typescript -ws verify

README.md

+3-27
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ Browse this repository to see how easy distributed applications development beco
2323
If you want to join the Restate community in order to stay up to date, then please join our [Discord](https://discord.gg/skW3AZ6uGd).
2424
The Discord server is also the perfect place for sharing your feedback with us, learning more about Restate and connect with others!
2525

26-
## Running the examples
27-
28-
> **Note**
29-
> Make sure you have [signed up for Restate's private beta](https://forms.gle/G8kDuucqhBoTfMwLA) and set up [access to Restate's packages](https://github.com/restatedev/restate-dist).
30-
3126
### Launching the runtime
3227

3328
Have a look at how to start up the runtime in a Docker container in [this repository]* or run the following commands:
@@ -77,27 +72,8 @@ This should give you the following output in case of the ticket reservation exam
7772

7873
## Releasing (for Restate developers)
7974

80-
In order to create a new release, push a tag of the form `vX.Y.Z`.
81-
Then [create a release via GitHub](https://github.com/restatedev/example-lambda-ts-greeter/releases).
82-
83-
### Upgrading the SDK dependency (for Restate developers)
84-
85-
In order to upgrade/update the SDK dependency you have to run:
86-
87-
**Major version** change:
88-
89-
```shell
90-
npm --prefix typescript install @restatedev/restate-sdk@^Z.Y.X --workspaces
91-
```
92-
93-
**Minor/patch version** change:
75+
Before releasing, trigger the "pre-release" workflow to update sdk versions. This automatically creates a pull request, which must be manually merged.
9476

95-
```shell
96-
npm --prefix typescript update @restatedev/restate-sdk --workspaces
97-
```
77+
Once the repo is ready for the release, push a tag of the form `vX.Y.Z`.
9878

99-
Now check whether the examples are still building:
100-
101-
```shell
102-
npm --prefix typescript run verify --workspaces
103-
```
79+
This triggers a workflow that [creates a draft release](https://github.com/restatedev/examples/releases) on Github, which you need to approve to finalize it.

scripts/prepare_examples_zip.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
OUT_DIR="$(pwd)"
4+
5+
zip_ts_example() {
6+
pushd typescript && zip -r typescript-$1.zip $1 -x '*node_modules*' '*dist*' && popd || exit
7+
mv typescript/typescript-$1.zip $OUT_DIR
8+
echo "Zip for $1 in $OUT_DIR/typescript-$1.zip"
9+
}
10+
11+
zip_jvm_example() {
12+
pushd jvm && zip -r jvm-$1.zip $1 -x '*.gradle*' '*build*' '*.idea*' && popd || exit
13+
mv jvm/jvm-$1.zip $OUT_DIR
14+
echo "Zip for $1 in $OUT_DIR/jvm-$1.zip"
15+
}
16+
17+
zip_ts_example lambda-greeter
18+
19+
zip_jvm_example java-blocking-http
20+
zip_jvm_example java-blocking-lambda
21+
zip_jvm_example kotlin-http
22+
zip_jvm_example kotlin-lambda

0 commit comments

Comments
 (0)