File tree 2 files changed +95
-0
lines changed 2 files changed +95
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ BUILD_FOLDER=build
4
+ VERSION=$( cat common/banner.go | grep Version | cut -d ' "' -f 2)
5
+
6
+ bin_dep () {
7
+ BIN=$1
8
+ which $BIN > /dev/null || {
9
+ echo " [-] Dependency $BIN not found !"
10
+ exit 1
11
+ }
12
+ }
13
+
14
+ create_exe_archive () {
15
+ bin_dep ' zip'
16
+
17
+ OUTPUT=$1
18
+
19
+ echo " [*] Creating archive $OUTPUT ..."
20
+ zip -j " $OUTPUT " gitrob.exe ../README.md ../LICENSE.txt ../contentsignatures.json ../filesignatures.json > /dev/null
21
+ rm -rf gitrob gitrob.exe
22
+ }
23
+
24
+ create_archive () {
25
+ bin_dep ' zip'
26
+
27
+ OUTPUT=$1
28
+
29
+ echo " [*] Creating archive $OUTPUT ..."
30
+ zip -j " $OUTPUT " gitrob ../README.md ../LICENSE.md ../contentsignatures.json ../filesignatures.json > /dev/null
31
+ rm -rf gitrob gitrob.exe
32
+ }
33
+
34
+ build_linux_amd64 () {
35
+ echo " [*] Building linux/amd64 ..."
36
+ GOOS=linux GOARCH=amd64 go build -o gitrob ..
37
+ }
38
+
39
+ build_macos_amd64 () {
40
+ echo " [*] Building darwin/amd64 ..."
41
+ GOOS=darwin GOARCH=amd64 go build -o gitrob ..
42
+ }
43
+
44
+ build_windows_amd64 () {
45
+ echo " [*] Building windows/amd64 ..."
46
+ GOOS=windows GOARCH=amd64 go build -o gitrob.exe ..
47
+ }
48
+
49
+ rm -rf $BUILD_FOLDER
50
+ mkdir $BUILD_FOLDER
51
+ cd $BUILD_FOLDER
52
+
53
+ build_linux_amd64 && create_archive gitrob_linux_amd64_$VERSION .zip
54
+ build_macos_amd64 && create_archive gitrob_macos_amd64_$VERSION .zip
55
+ # windows builds are broken with the addition of go-gitlab
56
+ # build_windows_amd64 && create_exe_archive gitrob_windows_amd64_$VERSION.zip
57
+ shasum -a 256 * > checksums.txt
58
+
59
+ echo
60
+ echo
61
+ du -sh *
62
+
63
+ cd --
64
+
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ CURRENT_VERSION=$( cat common/banner.go | grep Version | cut -d ' "' -f 2)
4
+ TO_UPDATE=(
5
+ common/banner.go
6
+ )
7
+
8
+ read -p " [?] Did you remember to update CHANGELOG.md? "
9
+ read -p " [?] Did you remember to update README.md with new features/changes? "
10
+
11
+ echo -n " [*] Current version is $CURRENT_VERSION . Enter new version: "
12
+ read NEW_VERSION
13
+ echo " [*] Pushing and tagging version $NEW_VERSION in 5 seconds..."
14
+ sleep 5
15
+
16
+ for file in " ${TO_UPDATE[@]} " ; do
17
+ echo " [*] Patching $file ..."
18
+ sed -i " s/$CURRENT_VERSION /$NEW_VERSION /g" $file
19
+ git add $file
20
+ done
21
+
22
+ git add CHANGELOG.md
23
+ git commit -m " Releasing v$NEW_VERSION "
24
+ git push
25
+
26
+ git tag -a v$NEW_VERSION -m " Release v$NEW_VERSION "
27
+ git push origin v$NEW_VERSION
28
+
29
+ echo
30
+ echo " [*] All done, v$NEW_VERSION released."
31
+
You can’t perform that action at this time.
0 commit comments