File tree Expand file tree Collapse file tree 4 files changed +141
-0
lines changed Expand file tree Collapse file tree 4 files changed +141
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : release
2
+
3
+ on : push
4
+
5
+ jobs :
6
+ build :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - name : Checkout
10
+ uses : actions/checkout@v2
11
+ - name : Release
12
+ uses : softprops/action-gh-release@v1
13
+ if : startsWith(github.ref, 'refs/tags/')
14
+ with :
15
+ body : Check CHANGELOG.md for details
Original file line number Diff line number Diff line change
1
+ # Releasing
2
+
3
+ 1 . Run ` release.sh ` script which updates versions in go.mod files and pushes a new branch to GitHub:
4
+
5
+ ``` shell
6
+ ./scripts/release.sh -t v1.0.0
7
+ ```
8
+
9
+ 2 . Open a pull request and wait for the build to finish.
10
+
11
+ 3 . Merge the pull request and run ` tag.sh ` to create tags for packages:
12
+
13
+ ``` shell
14
+ ./scripts/tag.sh -t v1.0.0
15
+ ```
16
+
17
+ 4 . Push the tags:
18
+
19
+ ``` shell
20
+ git push origin --tags
21
+ ```
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ help () {
6
+ cat << - EOF
7
+ Usage: TAG=tag $0
8
+
9
+ Updates version in go.mod files and pushes a new brash to GitHub.
10
+
11
+ VARIABLES:
12
+ TAG git tag, for example, v1.0.0
13
+ EOF
14
+ exit 0
15
+ }
16
+
17
+ if [ -z " $TAG " ]
18
+ then
19
+ printf " TAG is required\n\n"
20
+ help
21
+ fi
22
+
23
+ TAG_REGEX=" ^v(0|[1-9][0-9]*)\\ .(0|[1-9][0-9]*)\\ .(0|[1-9][0-9]*)(\\ -[0-9A-Za-z-]+(\\ .[0-9A-Za-z-]+)*)?(\\ +[0-9A-Za-z-]+(\\ .[0-9A-Za-z-]+)*)?$"
24
+ if ! [[ " ${TAG} " =~ ${TAG_REGEX} ]]; then
25
+ printf " TAG is not valid: ${TAG} \n\n"
26
+ exit 1
27
+ fi
28
+
29
+ TAG_FOUND=` git tag --list ${TAG} `
30
+ if [[ ${TAG_FOUND} = ${TAG} ]] ; then
31
+ printf " tag ${TAG} already exists\n\n"
32
+ exit 1
33
+ fi
34
+
35
+ if ! git diff --quiet
36
+ then
37
+ printf " working tree is not clean\n\n"
38
+ git status
39
+ exit 1
40
+ fi
41
+
42
+ git checkout master
43
+
44
+ PACKAGE_DIRS=$( find . -mindepth 2 -type f -name ' go.mod' -exec dirname {} \; \
45
+ | sed ' s/^\.\///' \
46
+ | sort)
47
+
48
+ for dir in $PACKAGE_DIRS
49
+ do
50
+ sed --in-place \
51
+ " s/uptrace\/bun\([^ ]*\) v.*/uptrace\/bun\1 ${TAG} /" " ${dir} /go.mod"
52
+ done
53
+
54
+ for dir in $PACKAGE_DIRS
55
+ do
56
+ printf " ${dir} : go mod tidy\n"
57
+ (cd ./${dir} && go mod tidy)
58
+ done
59
+
60
+ sed --in-place " s/\(return \)\" [^\" ]*\" /\1\" ${TAG# v} \" /" ./version.go
61
+
62
+ git checkout -b release/${TAG} master
63
+ git add -u
64
+ git commit -m " Release $TAG "
65
+ git push origin release/${TAG}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ help () {
6
+ cat << - EOF
7
+ Usage: TAG=tag $0
8
+
9
+ Creates git tags for public Go packages.
10
+
11
+ VARIABLES:
12
+ TAG git tag, for example, v1.0.0
13
+ EOF
14
+ exit 0
15
+ }
16
+
17
+ if [ -z " $TAG " ]
18
+ then
19
+ printf " TAG env var is required\n\n" ;
20
+ help
21
+ fi
22
+
23
+ if ! grep -Fq " \" ${TAG# v} \" " version.go
24
+ then
25
+ printf " version.go does not contain ${TAG# v} \n"
26
+ exit 1
27
+ fi
28
+
29
+ PACKAGE_DIRS=$( find . -mindepth 2 -type f -name ' go.mod' -exec dirname {} \; \
30
+ | grep -E -v " example|internal" \
31
+ | sed ' s/^\.\///' \
32
+ | sort)
33
+
34
+ git tag ${TAG}
35
+
36
+ for dir in $PACKAGE_DIRS
37
+ do
38
+ printf " tagging ${dir} /${TAG} \n"
39
+ git tag ${dir} /${TAG}
40
+ done
You can’t perform that action at this time.
0 commit comments