Skip to content

Pre-release updates #14

Pre-release updates

Pre-release updates #14

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
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 }}
- 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 }}
# 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
# Setup Java
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
# 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
# Check Java code snippets
- name: Test Java code snippets
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: code_snippets/java
# 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 Kotlin code snippets
- name: Test Kotlin code snippets
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: code_snippets/kotlin
- 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/*
docs/references/*