File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : Build and Release Go Binary
1+ name : Build and Release Go Binaries
22
33on :
44 push :
@@ -16,13 +16,24 @@ jobs:
1616 with :
1717 go-version : ' 1.21'
1818
19- - name : Build binary
19+ - name : Build binaries for all platforms
2020 run : |
21- go build -o commit-msg-go commit-msg.go
21+ GOOS=linux GOARCH=amd64 go build -o commit-msg-go-linux-amd64 commit-msg.go
22+ GOOS=linux GOARCH=arm64 go build -o commit-msg-go-linux-arm64 commit-msg.go
23+ GOOS=darwin GOARCH=amd64 go build -o commit-msg-go-darwin-amd64 commit-msg.go
24+ GOOS=darwin GOARCH=arm64 go build -o commit-msg-go-darwin-arm64 commit-msg.go
25+ GOOS=windows GOARCH=amd64 go build -o commit-msg-go-windows-amd64.exe commit-msg.go
26+ GOOS=windows GOARCH=arm64 go build -o commit-msg-go-windows-arm64.exe commit-msg.go
2227
23- - name : Upload Release Asset
28+ - name : Upload Release Assets
2429 uses : softprops/action-gh-release@v2
2530 with :
26- files : commit-msg-go
31+ files : |
32+ commit-msg-go-linux-amd64
33+ commit-msg-go-linux-arm64
34+ commit-msg-go-darwin-amd64
35+ commit-msg-go-darwin-arm64
36+ commit-msg-go-windows-amd64.exe
37+ commit-msg-go-windows-arm64.exe
2738 env :
2839 GITHUB_TOKEN : ${{ secrets.GH_PAT }}
Original file line number Diff line number Diff line change 44HOOK_PATH=" .git/hooks/commit-msg"
55BIN_PATH=" .git/hooks/commit-msg-go"
66HOOK_URL=" https://raw.githubusercontent.com/inem/dotdotdot/main/_git/hooks/commit-msg"
7- BIN_URL=" https://github.com/inem/dotdotdot/releases/latest/download/commit-msg-go"
7+
8+ # Detect OS and ARCH
9+ OS=$( uname | tr ' [:upper:]' ' [:lower:]' )
10+ ARCH=$( uname -m)
11+
12+ case " $ARCH " in
13+ x86_64|amd64)
14+ ARCH=amd64
15+ ;;
16+ arm64|aarch64)
17+ ARCH=arm64
18+ ;;
19+ * )
20+ echo " Unsupported architecture: $ARCH "
21+ exit 1
22+ ;;
23+ esac
24+
25+ case " $OS " in
26+ linux|darwin)
27+ ;;
28+ msys* |cygwin* |mingw* |windowsnt|windows)
29+ OS=windows
30+ BIN_PATH=" .git/hooks/commit-msg-go.exe"
31+ ;;
32+ * )
33+ echo " Unsupported OS: $OS "
34+ exit 1
35+ ;;
36+ esac
37+
38+ BIN_URL=" https://github.com/inem/dotdotdot/releases/latest/download/commit-msg-go-${OS} -${ARCH} "
839
940if [ ! -d .git/hooks ]; then
1041 echo " Error: .git/hooks directory not found. Please run this script from the root of your git repository."
@@ -16,7 +47,7 @@ curl -fsSL "$HOOK_URL" -o "$HOOK_PATH"
1647chmod +x " $HOOK_PATH "
1748echo " Hook installed to $HOOK_PATH "
1849
19- echo " Downloading Go binary from GitHub Releases ..."
50+ echo " Downloading Go binary for $OS - $ARCH ..."
2051curl -fsSL " $BIN_URL " -o " $BIN_PATH "
2152chmod +x " $BIN_PATH "
2253echo " Binary installed to $BIN_PATH "
You can’t perform that action at this time.
0 commit comments