File tree Expand file tree Collapse file tree 2 files changed +40
-6
lines changed Expand file tree Collapse file tree 2 files changed +40
-6
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,5 @@ The class home page is https://devnull-cz.github.io/unix-linux-prog-in-c/
13
13
## Trigger new release
14
14
15
15
```
16
- # get the latest tag
17
- $ git tag | sed 's/^v//' | sort -n | tail -1
18
- # create new tag
19
- $ git tag v<XYZ>
20
- # push it to the repo
21
- $ git push origin v<XYZ>
16
+ ./dev/release.sh v<XYZ>
22
17
```
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # Trigger new release creation on Github.
4
+ #
5
+
6
+ set -e
7
+
8
+ if (( $# > 1 )) ; then
9
+ echo " usage: ` basename $0 ` [version]"
10
+ exit 1
11
+ fi
12
+
13
+ # Get the latest version (needs curl + jq).
14
+ if (( $# == 0 )) ; then
15
+ curl -s https://api.github.com/repos/devnull-cz/unix-linux-prog-in-c/releases/latest | \
16
+ jq .tag_name
17
+ exit 0
18
+ fi
19
+
20
+ VERSION=$1
21
+
22
+ if ! echo " $VERSION " | grep ' ^[0-9]\+\.[0-9]\+\.[0-9]\+$' > /dev/null; then
23
+ echo " version needs to be in the form of <num>.<num>.<num>"
24
+ exit 1
25
+ fi
26
+
27
+ ver=$( git tag -l " $VERSION " )
28
+ if (( $? != 0 )) ; then
29
+ echo " Cannot determine tag"
30
+ exit 1
31
+ fi
32
+ if [[ $ver == $VERSION ]]; then
33
+ echo " Tag $VERSION already exists"
34
+ exit 1
35
+ fi
36
+
37
+ git pull --ff-only
38
+ git tag " $VERSION "
39
+ git push origin tag " $VERSION "
You can’t perform that action at this time.
0 commit comments