Pre-release updates #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
sdkJavaVersion: | |
description: "sdk-java version (without 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 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 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 | |
- 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/* |