Skip to content

Commit 096b304

Browse files
committed
chore: Add wl-tag.sh script to create tags in a consistent manner
Signed-off-by: Rafael Fernández López <[email protected]>
1 parent d3d8901 commit 096b304

File tree

4 files changed

+39
-9
lines changed

4 files changed

+39
-9
lines changed

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,12 @@ git commit -m "Add support to build php version 7.3.33"
136136

137137
## Performing a release
138138

139-
In order to perform a release, push a tag of the following form
140-
depending on the project artifacts you want to be built and published:
139+
In order to perform a release, you first have to tag the project you want to release. You can create a tag by using the `scripts/wl-tag.sh` script.
141140

142-
- `php/<version>+YYYYMMDD-<short-sha>`, where version can be any of:
143-
- `7.3.33`
144-
- `7.4.32`
141+
This script accepts the path to be released, and will create a local tag of the form `<project>/<version>+YYYYMMDD-<short-sha>`. All parameters will be automatically filled by the script, so in order to create a valid tag for PHP 7.3.33, for example, you only have to execute:
145142

146-
An example of a tag following the convention that triggers automation would be `php/7.3.33+20221123-8dfe8b9`.
143+
- `scripts/wl-tag.sh php/php-7.3.33`
147144

148-
When the tag is pushed to the repository, a GitHub release will be
149-
created automatically, and relevant artifacts will be automatically
150-
published to the release.
145+
This will create a tag like the following in your local repository: `php/7.3.33+20221123-d3d8901`.
146+
147+
When you push the tag to the remote repository, a GitHub release will be created automatically, and relevant artifacts will be automatically published to the release.

php/php-7.3.33/wl-tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export WLR_TAG="php/7.3.33"

php/php-7.4.32/wl-tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export WLR_TAG="php/7.4.32"

scripts/wl-tag.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
# This script allows you to tag a runtime that lives inside of this
4+
# project. It only accepts one parameter, that is the path to the
5+
# project to be tagged. A tag will be created locally that contains
6+
# the date and a the short SHA of HEAD.
7+
#
8+
# When the tag is pushed to the remote repository, automation will
9+
# take care of running the tests and generating the public artifacts.
10+
11+
set -e
12+
13+
TAG_DATE=$(date -u '+%Y%m%d')
14+
SHORT_SHA=$(git rev-parse --short HEAD)
15+
16+
if [ $# -ne 1 ]; then
17+
echo "$0 usage: $0 path/to/project"
18+
exit 1
19+
fi
20+
21+
if [ ! -f $1/wl-tag.sh ]; then
22+
echo "cannot tag $1; missing $1/wl-tag.sh"
23+
exit 1
24+
fi
25+
26+
source $1/wl-tag.sh
27+
WLR_FINAL_TAG="${WLR_TAG}+${TAG_DATE}-${SHORT_SHA}"
28+
29+
git tag -s $WLR_FINAL_TAG -m "Release $WLR_TAG"
30+
31+
echo "tag created: $WLR_FINAL_TAG"

0 commit comments

Comments
 (0)