diff --git a/.github/scripts/create-release.sh b/.github/scripts/create-release.sh new file mode 100755 index 0000000000..f5e49047d6 --- /dev/null +++ b/.github/scripts/create-release.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# +# Copyright 2025 The Dapr Authors +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ue + +# Thanks to https://ihateregex.io/expr/semver/ +SEMVER_REGEX='^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + +REL_VERSION=`echo $1 | sed -r 's/^[vV]?([0-9].+)$/\1/'` + +if [ `echo $REL_VERSION | pcre2grep "$SEMVER_REGEX"` ]; then + echo "$REL_VERSION is a valid semantic version." +else + echo "$REL_VERSION is not a valid semantic version." + exit 1 +fi + +MAJOR_MINOR_VERSION=`echo $REL_VERSION | cut -d. -f1,2` +RELEASE_BRANCH="release-$MAJOR_MINOR_VERSION" +RELEASE_TAG="v$REL_VERSION" +SUFFIX=`echo $REL_VERSION | grep \- | cut -d- -f2 | cut -d. -f1` +if [ "$SUFFIX" == "alpha" ]; then + # Alpha releases come from the master branch as they are not complete for an RC yet. + RELEASE_BRANCH="master" +fi + +if [ `git rev-parse --verify origin/$RELEASE_BRANCH 2>/dev/null` ]; then + echo "$RELEASE_BRANCH branch already exists, checking it out ..." + git checkout $RELEASE_BRANCH +else + echo "$RELEASE_BRANCH does not exist, creating ..." + git checkout -b $RELEASE_BRANCH + git push origin $RELEASE_BRANCH +fi +echo "$RELEASE_BRANCH branch is ready." + +if [ `git rev-parse --verify $RELEASE_TAG 2>/dev/null` ]; then + echo "$RELEASE_TAG tag already exists, aborting ..." + exit 2 +fi + +echo "Tagging $RELEASE_TAG ..." +git tag $RELEASE_TAG +echo "$RELEASE_TAG is tagged." + +echo "Pushing $RELEASE_TAG tag ..." +git push origin $RELEASE_TAG +echo "$RELEASE_TAG tag is pushed." diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml new file mode 100644 index 0000000000..ab0356d590 --- /dev/null +++ b/.github/workflows/create-release.yaml @@ -0,0 +1,49 @@ +# +# Copyright 2025 The Dapr Authors +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: Create a release + +on: + workflow_dispatch: + inputs: + rel_version: + description: 'Release version (examples: 1.16.0-rc.1, 1.16.0)' + required: true + type: string + +permissions: {} + +jobs: + create-release: + name: Creates release branch and tag + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install required packages + run: | + sudo apt-get update + sudo apt-get install pcre2-utils + - name: Create release branch and tag + env: + GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }} + run: | + git config user.email "daprweb@diagrid.io" + git config user.name "Dapr Bot" + # Update origin with token + git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + ./.github/scripts/create-release.sh ${{ inputs.rel_version }} \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000000..00629a9c2c --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,45 @@ +# Release Guide + +This document describes how to release Dapr Components Contrib along with associated artifacts. + +## Prerequisites + +Only maintainers and the release team should run releases. + +## Pre-release + +Pre-releases use tags like `v1.11.0-rc.0`, `-rc.1`, and so on. They are created through the GitHub Actions workflow. + +### Steps + +1. Update the Dapr runtime and dashboard versions in workflows or tests if needed. Merge that change to master. + +2. Open GitHub Actions and click the **create-release** workflow. + +3. Press the **Run workflow** button. + The workflow will: + + * create the `release-.` branch + * create the pre-release tag + * build the artifacts + +4. Test the produced build. + +5. If there are issues, fix them in the release branch and trigger the workflow again by creating a new pre-release tag (for example `-rc.1`). + +6. Repeat until the build is good. + +## Stable Release + +Create a stable tag without the rc suffix (for example `v1.11.0`). +CI will build and publish the release. + +## Patch Releases + +Use the existing release branch. +Create a new pre-release tag like `v1.11.1-rc.0`, test it, and when ready tag the stable version `v1.11.1`. +CI will build and publish it. + +## Project Release Guidelines + +See [this document](https://github.com/dapr/community/blob/master/release-process.md) for the project's release process and guidelines. \ No newline at end of file