Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: "sdk-go version (without the prepending v). Leave empty if you do not want to update it."
required: false
type: string
sdkGoTunnelVersion:
description: "Go tunnel module version (without prepending v). Leave empty to keep the current version."
required: false
type: string
sdkPythonVersion:
description: "sdk-python version (without prepending v). Leave empty if you do not want to update it."
required: false
Expand Down Expand Up @@ -151,16 +155,19 @@ jobs:
add-paths: ${{ steps.changes.outputs.paths }}

go:
if: github.repository_owner == 'restatedev' && inputs.sdkGoVersion != ''
if: github.repository_owner == 'restatedev' && (inputs.sdkGoVersion != '' || inputs.sdkGoTunnelVersion != '')
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Bump sdk-go
run: ./.tools/update_go_examples.sh ${{ inputs.sdkGoVersion }}
go-version-file: go/templates/go-kubernetes/go.mod
- name: Bump Go dependencies
env:
SDK_GO_VERSION: ${{ inputs.sdkGoVersion }}
SDK_GO_TUNNEL_VERSION: ${{ inputs.sdkGoTunnelVersion }}
run: ./.tools/update_go_examples.sh "$SDK_GO_VERSION" "$SDK_GO_TUNNEL_VERSION"
- name: Compute paths to commit
id: changes
run: |
Expand All @@ -173,8 +180,8 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "[GithubActions] Update SDK-Go ${{ inputs.sdkGoVersion }}"
commit-message: "[GithubActions] Update SDK-Go ${{ inputs.sdkGoVersion }}"
title: "[GithubActions] Update Go dependencies ${{ inputs.sdkGoVersion != '' && format('SDK {0}', inputs.sdkGoVersion) || '' }} ${{ inputs.sdkGoTunnelVersion != '' && format('Tunnel {0}', inputs.sdkGoTunnelVersion) || '' }}"
commit-message: "[GithubActions] Update Go dependencies ${{ inputs.sdkGoVersion != '' && format('SDK {0}', inputs.sdkGoVersion) || '' }} ${{ inputs.sdkGoTunnelVersion != '' && format('Tunnel {0}', inputs.sdkGoTunnelVersion) || '' }}"
branch: pre-release/go
add-paths: ${{ steps.changes.outputs.paths }}

Expand Down
25 changes: 19 additions & 6 deletions .tools/update_go_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,36 @@

set -eufx -o pipefail

NEW_VERSION=v$1
SDK_VERSION=${1:-}
TUNNEL_VERSION=${2:-}
SELF_PATH=${BASH_SOURCE[0]:-"$(command -v -- "$0")"}
PROJECT_ROOT="$(dirname "$SELF_PATH")/.."

function bump_go_sdk() {
pushd $1
go get github.com/restatedev/sdk-go@$NEW_VERSION
local project_dir=$1
local modules=()
if [[ -n "$SDK_VERSION" ]]; then
modules+=("github.com/restatedev/sdk-go@v${SDK_VERSION#v}")
fi
if [[ -n "$TUNNEL_VERSION" ]] && grep -Eq '^[[:space:]]*(require[[:space:]]+)?github.com/restatedev/sdk-go/x/tunnel[[:space:]]' "$project_dir/go.mod"; then
modules+=("github.com/restatedev/sdk-go/x/tunnel@v${TUNNEL_VERSION#v}")
fi
if [[ ${#modules[@]} -eq 0 ]]; then
return
fi

pushd "$project_dir"
go get "${modules[@]}"
go mod tidy
go test ./...


# If this is a template directory and has existing agents documentation, update it
local project_dir=$1
if [[ "$project_dir" == *"/templates/"* ]] && [ -f "./.cursor/rules/AGENTS.md" ]; then
if [[ -n "$SDK_VERSION" && "$project_dir" == *"/templates/"* ]] && [ -f "./.cursor/rules/AGENTS.md" ]; then
echo "Updating agents documentation for template in $project_dir"
wget -O "./.cursor/rules/AGENTS.md" https://docs.restate.dev/develop/go/agents.md
fi
if [[ "$project_dir" == *"/templates/"* ]] && [ -f "./.claude/CLAUDE.md" ]; then
if [[ -n "$SDK_VERSION" && "$project_dir" == *"/templates/"* ]] && [ -f "./.claude/CLAUDE.md" ]; then
echo "Updating agents documentation for template in $project_dir"
wget -O "./.claude/CLAUDE.md" https://docs.restate.dev/develop/go/agents.md
fi
Expand Down
Loading