Skip to content

Pre-release updates #26

Pre-release updates

Pre-release updates #26

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
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: ${{ 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: ${{ 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/*