Skip to content

Pre-release updates #10

Pre-release updates

Pre-release updates #10

Workflow file for this run

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: 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 }}
# 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
- name: Install dasel
if: github.event.inputs.sdkJavaVersion != ''
run: curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel && mv ./dasel /usr/local/bin/dasel
# This automatically bumps kotlin as well
- name: Bump Java SDK version in code snippets
if: github.event.inputs.sdkJavaVersion != ''
run: dasel -f snippets/java/gradle/libs.versions.toml put -t string -v "${{ inputs.sdkJavaVersion }}" ".versions.restate"
- 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: cargo update --manifest-path ./snippets/rust/Cargo.toml restate-sdk@${{ inputs.sdkRustVersion }}
- 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/build.gradle.kts
snippets/python/pyproject.toml
snippets/go/go.mod
snippets/go/go.sum
snippets/rust/Cargo.lock
snippets/rust/Cargo.toml