@@ -81,70 +81,73 @@ jobs:
8181 run : |
8282 mkdir -p build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}
8383
84+ VERSION="${GITHUB_REF#refs/tags/}"
85+ GO_LDFLAGS="-s -w -X main.Version=${VERSION}"
86+
8487 case "${{ matrix.os }}_${{ matrix.arch }}" in
8588 windows_amd64)
8689 CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
87- go build -trimpath -ldflags="-s -w " \
90+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
8891 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus.exe .
8992 ;;
9093 windows_arm64)
9194 CGO_ENABLED=0 GOOS=windows GOARCH=arm64 \
92- go build -trimpath -ldflags="-s -w " \
95+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
9396 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus.exe .
9497 ;;
9598 darwin_amd64)
9699 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
97- go build -trimpath -ldflags="-s -w " \
100+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
98101 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
99102 ;;
100103 darwin_arm64)
101104 CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
102- go build -trimpath -ldflags="-s -w " \
105+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
103106 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
104107 ;;
105108 linux_amd64)
106109 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
107- go build -trimpath -ldflags="-s -w " \
110+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
108111 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
109112 ;;
110113 linux_arm64)
111114 CGO_ENABLED=0 GOOS=linux GOARCH=arm64 \
112- go build -trimpath -ldflags="-s -w " \
115+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
113116 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
114117 ;;
115118 linux_armv5)
116119 CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 \
117- go build -trimpath -ldflags="-s -w " \
120+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
118121 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
119122 ;;
120123 linux_armv6)
121124 CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 \
122- go build -trimpath -ldflags="-s -w " \
125+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
123126 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
124127 ;;
125128 linux_armv7)
126129 CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 \
127- go build -trimpath -ldflags="-s -w " \
130+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
128131 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
129132 ;;
130133 linux_mips)
131134 CGO_ENABLED=0 GOOS=linux GOARCH=mips \
132- go build -trimpath -ldflags="-s -w " \
135+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
133136 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
134137 ;;
135138 linux_mipsle)
136139 CGO_ENABLED=0 GOOS=linux GOARCH=mipsle \
137- go build -trimpath -ldflags="-s -w " \
140+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
138141 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
139142 ;;
140143 linux_mips64)
141144 CGO_ENABLED=0 GOOS=linux GOARCH=mips64 \
142- go build -trimpath -ldflags="-s -w " \
145+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
143146 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
144147 ;;
145148 linux_mips64le)
146149 CGO_ENABLED=0 GOOS=linux GOARCH=mips64le \
147- go build -trimpath -ldflags="-s -w " \
150+ go build -trimpath -ldflags="${GO_LDFLAGS} " \
148151 -o build/masque-plus/${{ matrix.os }}_${{ matrix.arch }}/masque-plus .
149152 ;;
150153 *)
0 commit comments