From 5692ec03a338ebb311a5d849c1114e53173de619 Mon Sep 17 00:00:00 2001 From: itowlson Date: Mon, 18 Sep 2023 12:08:01 +1200 Subject: [PATCH 1/6] Enable template SDK refs to be changed from `main` Signed-off-by: itowlson --- templates/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/Makefile b/templates/Makefile index 528c30321c..2000c4e3ca 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -5,7 +5,7 @@ bump-versions: bump-go-versions bump-rust-versions bump-go-versions: @for dir in $$(ls -d *-go) ; do \ cd $$dir/content ; \ - sed -i.sed-bak -e 's%require github.com/fermyon/spin/sdk/go v.*%require github.com/fermyon/spin/sdk/go ${SDK_VERSION}%g' go.mod ; \ + sed -r -i.sed-bak -e 's%require github.com/fermyon/spin/sdk/go [a-zA-Z0-9.]+%require github.com/fermyon/spin/sdk/go ${SDK_VERSION}%g' go.mod ; \ sed -i.sed-bak -e 's/{{project-name | snake_case}}/foo/g' go.mod ; \ go mod tidy ; \ sed -i.sed-bak -e 's/foo/{{project-name | snake_case}}/g' go.mod ; \ @@ -16,7 +16,7 @@ bump-go-versions: bump-rust-versions: @for dir in $$(ls -d *-rust) ; do \ cd $$dir/content ; \ - sed -i.sed-bak -e 's%"https://github.com/fermyon/spin", tag = "v.*"%"https://github.com/fermyon/spin", tag = "${SDK_VERSION}"%g' Cargo.toml ; \ + sed -r -i.sed-bak -e 's%"https://github.com/fermyon/spin", tag = "[a-zA-Z0-9.]+"%"https://github.com/fermyon/spin", tag = "${SDK_VERSION}"%g' Cargo.toml ; \ rm *.sed-bak ; \ cd - 2>&1 >/dev/null ; \ done From 41771fab38020fb4685dbc53a10260602bf090d2 Mon Sep 17 00:00:00 2001 From: itowlson Date: Mon, 18 Sep 2023 12:39:58 +1200 Subject: [PATCH 2/6] Has to be branch not tag for main Signed-off-by: itowlson --- templates/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Makefile b/templates/Makefile index 2000c4e3ca..65f789aa57 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -16,7 +16,7 @@ bump-go-versions: bump-rust-versions: @for dir in $$(ls -d *-rust) ; do \ cd $$dir/content ; \ - sed -r -i.sed-bak -e 's%"https://github.com/fermyon/spin", tag = "[a-zA-Z0-9.]+"%"https://github.com/fermyon/spin", tag = "${SDK_VERSION}"%g' Cargo.toml ; \ + sed -r -i.sed-bak -e 's%"https://github.com/fermyon/spin", ((tag = "[a-zA-Z0-9.]+")|(branch = "main"))%"https://github.com/fermyon/spin", tag = "${SDK_VERSION}"%g' Cargo.toml ; \ rm *.sed-bak ; \ cd - 2>&1 >/dev/null ; \ done From 06cee0eb29309bcbc0abdafe2ee7beec17e74a43 Mon Sep 17 00:00:00 2001 From: itowlson Date: Mon, 18 Sep 2023 12:46:37 +1200 Subject: [PATCH 3/6] Point Rust templates at SDK on main Signed-off-by: itowlson --- templates/http-rust/content/Cargo.toml | 2 +- templates/redis-rust/content/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/http-rust/content/Cargo.toml b/templates/http-rust/content/Cargo.toml index deb3d847d3..71def0a408 100644 --- a/templates/http-rust/content/Cargo.toml +++ b/templates/http-rust/content/Cargo.toml @@ -16,6 +16,6 @@ bytes = "1" # General-purpose crate with common HTTP types. http = "0.2" # The Spin SDK. -spin-sdk = { git = "https://github.com/fermyon/spin", tag = "v1.5.1" } +spin-sdk = { git = "https://github.com/fermyon/spin", branch = "main" } [workspace] diff --git a/templates/redis-rust/content/Cargo.toml b/templates/redis-rust/content/Cargo.toml index d689c8d6c8..b69efc503b 100644 --- a/templates/redis-rust/content/Cargo.toml +++ b/templates/redis-rust/content/Cargo.toml @@ -14,6 +14,6 @@ anyhow = "1" # Crate to simplify working with bytes. bytes = "1" # The Spin SDK. -spin-sdk = { git = "https://github.com/fermyon/spin", tag = "v1.5.1" } +spin-sdk = { git = "https://github.com/fermyon/spin", branch = "main" } [workspace] From b17cca195c91ec1a64320e5791611df4725892f1 Mon Sep 17 00:00:00 2001 From: itowlson Date: Mon, 18 Sep 2023 12:55:36 +1200 Subject: [PATCH 4/6] I *think* this is how it works for Go Signed-off-by: itowlson --- templates/http-go/content/go.mod | 2 +- templates/redis-go/content/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/http-go/content/go.mod b/templates/http-go/content/go.mod index a1e7949338..9ca4f27c13 100644 --- a/templates/http-go/content/go.mod +++ b/templates/http-go/content/go.mod @@ -2,6 +2,6 @@ module github.com/{{project-name | snake_case}} go 1.17 -require github.com/fermyon/spin/sdk/go v1.5.1 +require github.com/fermyon/spin/sdk/go latest require github.com/julienschmidt/httprouter v1.3.0 // indirect diff --git a/templates/redis-go/content/go.mod b/templates/redis-go/content/go.mod index 865f1574ad..ba7f847401 100644 --- a/templates/redis-go/content/go.mod +++ b/templates/redis-go/content/go.mod @@ -2,4 +2,4 @@ module github.com/{{project-name | snake_case}} go 1.17 -require github.com/fermyon/spin/sdk/go v1.5.1 +require github.com/fermyon/spin/sdk/go latest From c9c14179631ead8d0de14dfa85024d96757d139d Mon Sep 17 00:00:00 2001 From: Vaughn Dice Date: Fri, 6 Oct 2023 12:10:35 -0600 Subject: [PATCH 5/6] set main as the revision for go templates Signed-off-by: Vaughn Dice --- templates/http-go/content/go.mod | 2 +- templates/redis-go/content/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/http-go/content/go.mod b/templates/http-go/content/go.mod index 9ca4f27c13..503efb1da2 100644 --- a/templates/http-go/content/go.mod +++ b/templates/http-go/content/go.mod @@ -2,6 +2,6 @@ module github.com/{{project-name | snake_case}} go 1.17 -require github.com/fermyon/spin/sdk/go latest +require github.com/fermyon/spin/sdk/go main require github.com/julienschmidt/httprouter v1.3.0 // indirect diff --git a/templates/redis-go/content/go.mod b/templates/redis-go/content/go.mod index ba7f847401..87d9d85a20 100644 --- a/templates/redis-go/content/go.mod +++ b/templates/redis-go/content/go.mod @@ -2,4 +2,4 @@ module github.com/{{project-name | snake_case}} go 1.17 -require github.com/fermyon/spin/sdk/go latest +require github.com/fermyon/spin/sdk/go main From fce21705aba2814e7520fcf0bccf9791973958dd Mon Sep 17 00:00:00 2001 From: Vaughn Dice Date: Fri, 6 Oct 2023 12:17:53 -0600 Subject: [PATCH 6/6] ci(releasing): updates per templates pointing to latest on main Signed-off-by: Vaughn Dice --- .github/workflows/release.yml | 12 ++++++++++-- docs/content/release-process.md | 2 -- templates/Makefile | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a759327269..e19ffc3720 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ on: push: branches: - main + - "v[0-9]+.[0-9]+" tags: - "v*" @@ -289,7 +290,14 @@ jobs: - name: Set the spin tag shell: bash - run: echo "SPIN_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + run: | + echo "SPIN_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + + - name: Set the PR base branch + shell: bash + run: | + IFS=. read -r major minor patch <<< "${{ env.SPIN_TAG }}" + echo "RELEASE_BRANCH=$major.$minor" >> $GITHUB_ENV - name: Change sdk version shell: bash @@ -312,7 +320,7 @@ jobs: title: "feat(templates): update sdk to ${{ env.SPIN_TAG }}" body: Update the SDK version used by the templates branch: update-sdk-${{ env.SPIN_TAG }} - base: main + base: ${{ env.RELEASE_BRANCH }} delete-branch: true committer: fermybot <103076628+fermybot@users.noreply.github.com> author: fermybot <103076628+fermybot@users.noreply.github.com> diff --git a/docs/content/release-process.md b/docs/content/release-process.md index 8df7b8dd3d..ab158e681e 100644 --- a/docs/content/release-process.md +++ b/docs/content/release-process.md @@ -14,7 +14,6 @@ To cut a major / minor release of Spin, you will need to do the following: 1. Switch to the release branch locally and update versions (e.g. `1.1.0-pre0` could `1.1.0`). - Bump the version in Spin's `Cargo.toml` - - Update SDK_VERSION in `templates/Makefile` - Run `make build` so that `Cargo.lock` and other associated files are updated PR these changes to the release branch ensuring that pull request has a base corresponding to the release branch (e.g. `v1.1`). @@ -62,7 +61,6 @@ $ ./.github/gh-backport.sh 1. Switch to the release branch locally and update versions (e.g. `1.1.0-pre0` could `1.1.1`). - Bump the version in Spin's `Cargo.toml` - - Update SDK_VERSION in `templates/Makefile` - Run `make build` so that `Cargo.lock` and other associated files are updated PR these changes to the release branch ensuring that pull request has a base corresponding to the release branch (e.g. `v1.1`). diff --git a/templates/Makefile b/templates/Makefile index 65f789aa57..8b26737bd0 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -1,4 +1,4 @@ -SDK_VERSION ?= v2.0.0-pre0 +SDK_VERSION ?= v0.0.0 bump-versions: bump-go-versions bump-rust-versions