Skip to content

Commit 807ca78

Browse files
ci: add create release wf (#1573)
* ci: add create release wf Signed-off-by: nelson.parente <nelson_parente@live.com.pt> * ci: update release.md Signed-off-by: nelson.parente <nelson_parente@live.com.pt> * fix: email Signed-off-by: nelson.parente <nelson_parente@live.com.pt> * Update docs/development/release.md Co-authored-by: Cassie Coyle <cassie@diagrid.io> Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> --------- Signed-off-by: nelson.parente <nelson_parente@live.com.pt> Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Co-authored-by: Cassie Coyle <cassie@diagrid.io>
1 parent be712b2 commit 807ca78

3 files changed

Lines changed: 120 additions & 0 deletions

File tree

.github/scripts/create-release.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2025 The Dapr Authors
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
set -ue
15+
16+
# Thanks to https://ihateregex.io/expr/semver/
17+
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-]+)*))?$'
18+
19+
REL_VERSION=`echo $1 | sed -r 's/^[vV]?([0-9].+)$/\1/'`
20+
21+
if [ `echo $REL_VERSION | pcre2grep "$SEMVER_REGEX"` ]; then
22+
echo "$REL_VERSION is a valid semantic version."
23+
else
24+
echo "$REL_VERSION is not a valid semantic version."
25+
exit 1
26+
fi
27+
28+
MAJOR_MINOR_VERSION=`echo $REL_VERSION | cut -d. -f1,2`
29+
RELEASE_BRANCH="release-$MAJOR_MINOR_VERSION"
30+
RELEASE_TAG="v$REL_VERSION"
31+
SUFFIX=`echo $REL_VERSION | grep \- | cut -d- -f2 | cut -d. -f1`
32+
if [ "$SUFFIX" == "alpha" ]; then
33+
# Alpha releases come from the master branch as they are not complete for an RC yet.
34+
RELEASE_BRANCH="master"
35+
fi
36+
37+
if [ `git rev-parse --verify origin/$RELEASE_BRANCH 2>/dev/null` ]; then
38+
echo "$RELEASE_BRANCH branch already exists, checking it out ..."
39+
git checkout $RELEASE_BRANCH
40+
else
41+
echo "$RELEASE_BRANCH does not exist, creating ..."
42+
git checkout -b $RELEASE_BRANCH
43+
git push origin $RELEASE_BRANCH
44+
fi
45+
echo "$RELEASE_BRANCH branch is ready."
46+
47+
if [ `git rev-parse --verify $RELEASE_TAG 2>/dev/null` ]; then
48+
echo "$RELEASE_TAG tag already exists, aborting ..."
49+
exit 2
50+
fi
51+
52+
echo "Tagging $RELEASE_TAG ..."
53+
git tag $RELEASE_TAG
54+
echo "$RELEASE_TAG is tagged."
55+
56+
echo "Pushing $RELEASE_TAG tag ..."
57+
git push origin $RELEASE_TAG
58+
echo "$RELEASE_TAG tag is pushed."
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Copyright 2025 The Dapr Authors
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
#
13+
14+
name: Create a release
15+
16+
on:
17+
workflow_dispatch:
18+
inputs:
19+
rel_version:
20+
description: 'Release version (examples: 1.16.0-rc.1, 1.16.0)'
21+
required: true
22+
type: string
23+
24+
permissions: {}
25+
26+
jobs:
27+
create-release:
28+
name: Creates release branch and tag
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: write
32+
steps:
33+
- name: Check out code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
- name: Install required packages
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install pcre2-utils
41+
- name: Create release branch and tag
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
44+
run: |
45+
git config user.email "dapr@dapr.io"
46+
git config user.name "Dapr Bot"
47+
# Update origin with token
48+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
49+
./.github/scripts/create-release.sh ${{ inputs.rel_version }}

docs/development/release.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ Only the repository maintainers and release team are allowed to execute the belo
99

1010
## Pre-release build
1111

12+
### Dapr CLI manual release process
13+
1214
Pre-release build will be built from `release-<major>.<minor>` branch and versioned by git version tag suffix e.g. `-rc.0`, `-rc.1`, etc. This build is not released to users who use the latest stable version.
15+
1316
**Pre-release process**
1417
1. Create a PR to update the `Dapr runtime` and `Dapr dashboard` pre-release versions in workflow and tests files wherever applicable, and merge the PR to master branch. For example, please take a look at this PR - https://github.com/dapr/cli/pull/1019. Please note that this PR is just for reference and only reflects the absolute minimum number of file changes. These versions update could lead to some other changes also.
1518

@@ -33,6 +36,12 @@ $ git push upstream v1.11.0-rc.0
3336
7. Create new pre-release version tag (with suffix -rc.1, -rc.2, etc).
3437
8. Repeat from 5 to 7 until all bugs are fixed.
3538

39+
### Dapr CLI automated release process
40+
41+
The Dapr CLI automated release process is triggered by the `create-release` workflow. This workflow is triggered by the `create-release` button in the GitHub Actions UI.
42+
43+
This workflow will create a new release branch and tag, and trigger the Dapr CLI build. Ensure the new release is set to `latest` and not a `pre-release`
44+
3645

3746
## Release the stable version to users
3847

@@ -43,3 +52,7 @@ Once all bugs are fixed, stable version can be released. Create a new git versio
4352
## Release Patch version
4453

4554
Work on the existing `release-<major>.<minor>` branch to release a patch version. Once all bugs are fixed, create a new patch version tag, such as `v1.11.1-rc.0`. After verifying the fixes on this pre-release, create a new git version tag such as `v1.11.1` and push the tag. CI will create the new build artifacts and release them.
55+
56+
## Project Release Guidelines
57+
58+
See [this document](https://github.com/dapr/community/blob/master/release-process.md) for the project's release process and guidelines.

0 commit comments

Comments
 (0)