Skip to content

Commit b63472c

Browse files
Update garm-provider-common and add build scripts
This change adds build scripts common to all providers maintained by us. Signed-off-by: Gabriel Adrian Samfira <[email protected]>
1 parent 52d06fd commit b63472c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+787
-1729
lines changed

.github/workflows/go-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- run: go version
2525

2626
- name: Run GARM Go Tests
27-
run: make go-test
27+
run: make test
2828

2929
go-tests-windows:
3030
runs-on: windows-latest
@@ -41,4 +41,4 @@ jobs:
4141
- run: go version
4242

4343
- name: Run GARM Go Tests
44-
run: go test -v ./... -timeout=15m -parallel=4
44+
run: go test -v ./... -timeout=15m -parallel=4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bin/
2+
release/
3+
build/

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM docker.io/golang:alpine
2+
3+
WORKDIR /root
4+
USER root
5+
6+
RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc
7+
8+
RUN wget http://musl.cc/aarch64-linux-musl-cross.tgz -O /tmp/aarch64-linux-musl-cross.tgz && \
9+
tar --strip-components=1 -C /usr/local -xzf /tmp/aarch64-linux-musl-cross.tgz && \
10+
rm /tmp/aarch64-linux-musl-cross.tgz
11+
12+
ADD ./scripts/build-static.sh /build-static.sh
13+
RUN chmod +x /build-static.sh
14+
15+
CMD ["/bin/sh"]

Makefile

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,60 @@
11
SHELL := bash
22

3-
.PHONY: go-test
3+
ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
4+
GOPATH ?= $(shell go env GOPATH)
5+
GO ?= go
6+
7+
IMAGE_TAG = garm-provider-build
8+
9+
USER_ID=$(shell ((docker --version | grep -q podman) && echo "0" || id -u))
10+
USER_GROUP=$(shell ((docker --version | grep -q podman) && echo "0" || id -g))
11+
GARM_PROVIDER_NAME := garm-provider-lxd
12+
13+
default: build
14+
15+
.PHONY : build build-static test install-lint-deps lint go-test fmt fmtcheck verify-vendor verify create-release-files release
16+
17+
build:
18+
@$(GO) build .
19+
20+
clean: ## Clean up build artifacts
21+
@rm -rf ./bin ./build ./release
22+
23+
build-static:
24+
@echo Building
25+
docker build --tag $(IMAGE_TAG) .
26+
mkdir -p build
27+
docker run --rm -e GARM_PROVIDER_NAME=$(GARM_PROVIDER_NAME) -e USER_ID=$(USER_ID) -e USER_GROUP=$(USER_GROUP) -v $(PWD)/build:/build/output:z -v $(PWD):/build/$(GARM_PROVIDER_NAME):z $(IMAGE_TAG) /build-static.sh
28+
@echo Binaries are available in $(PWD)/build
29+
30+
test: install-lint-deps verify go-test
31+
32+
install-lint-deps:
33+
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
34+
35+
lint:
36+
@golangci-lint run --timeout=8m --build-tags testing
437

538
go-test:
6-
go test -v ./... $(TEST_ARGS) -timeout=15m -parallel=4
39+
@$(GO) test -race -mod=vendor -tags testing -v $(TEST_ARGS) -timeout=15m -parallel=4 -count=1 ./...
40+
41+
fmt:
42+
@$(GO) fmt $$(go list ./...)
43+
44+
fmtcheck:
45+
@gofmt -l -s $$(go list ./... | sed -n 's/github.com\/cloudbase\/'$(GARM_PROVIDER_NAME)'\/\(.*\)/\1/p') | grep ".*\.go"; if [ "$$?" -eq 0 ]; then echo "gofmt check failed; please tun gofmt -w -s"; exit 1;fi
46+
47+
verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
48+
$(eval TMPDIR := $(shell mktemp -d))
49+
@cp -R ${ROOTDIR} ${TMPDIR}
50+
@(cd ${TMPDIR}/$(GARM_PROVIDER_NAME) && ${GO} mod tidy)
51+
@diff -r -u -q ${ROOTDIR} ${TMPDIR}/$(GARM_PROVIDER_NAME) >/dev/null 2>&1; if [ "$$?" -ne 0 ];then echo "please run: go mod tidy && go mod vendor"; exit 1; fi
52+
@rm -rf ${TMPDIR}
53+
54+
verify: verify-vendor lint fmtcheck
55+
56+
##@ Release
57+
create-release-files:
58+
./scripts/make-release.sh
59+
60+
release: build-static create-release-files ## Create a release

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ toolchain go1.22.1
77
require (
88
github.com/BurntSushi/toml v1.3.2
99
github.com/canonical/lxd v0.0.0-20240523084630-b0acaf2c63a0
10-
github.com/cloudbase/garm-provider-common v0.1.2
11-
github.com/gorilla/websocket v1.5.1
10+
github.com/cloudbase/garm-provider-common v0.1.3
11+
github.com/gorilla/websocket v1.5.4-0.20240702125206-a62d9d2a8413
1212
github.com/juju/clock v1.0.3
1313
github.com/juju/retry v1.0.0
1414
github.com/pkg/errors v0.9.1
@@ -41,12 +41,12 @@ require (
4141
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
4242
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
4343
github.com/zitadel/oidc/v2 v2.12.0 // indirect
44-
golang.org/x/crypto v0.23.0 // indirect
45-
golang.org/x/net v0.25.0 // indirect
44+
golang.org/x/crypto v0.25.0 // indirect
45+
golang.org/x/net v0.27.0 // indirect
4646
golang.org/x/oauth2 v0.20.0 // indirect
47-
golang.org/x/sys v0.20.0 // indirect
48-
golang.org/x/term v0.20.0 // indirect
49-
golang.org/x/text v0.15.0 // indirect
47+
golang.org/x/sys v0.22.0 // indirect
48+
golang.org/x/term v0.22.0 // indirect
49+
golang.org/x/text v0.16.0 // indirect
5050
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
5151
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
5252
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
22
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
33
github.com/canonical/lxd v0.0.0-20240523084630-b0acaf2c63a0 h1:Buunjih7uUBvJ2PQN2kP13x5wRY81pRnFovW0E/oWb8=
44
github.com/canonical/lxd v0.0.0-20240523084630-b0acaf2c63a0/go.mod h1:QSpzCRdkGzMnkPUG02Kvp2uzbxyNAwEvLXqR+beiLPI=
5-
github.com/cloudbase/garm-provider-common v0.1.2 h1:EqSpUjw9rzo4PiUmteHkFtZNWCnRi0QXHRKZ+VA1IPo=
6-
github.com/cloudbase/garm-provider-common v0.1.2/go.mod h1:igxJRT3OlykERYc6ssdRQXcb+BCaeSfnucg6I0OSoDc=
5+
github.com/cloudbase/garm-provider-common v0.1.3 h1:8pHSRs2ljwLHgtDrge68dZ7ILUW97VF5h2ZA2fQubGQ=
6+
github.com/cloudbase/garm-provider-common v0.1.3/go.mod h1:VIJzbcg5iwyD4ac99tnnwcActfwibn/VOt2MYOFjf2c=
77
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
88
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
99
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -31,8 +31,8 @@ github.com/gorilla/schema v1.3.0 h1:rbciOzXAx3IB8stEFnfTwO3sYa6EWlQk79XdyustPDA=
3131
github.com/gorilla/schema v1.3.0/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
3232
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
3333
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
34-
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
35-
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
34+
github.com/gorilla/websocket v1.5.4-0.20240702125206-a62d9d2a8413 h1:0Zn/h+BUQg6QHkybGvjFD7BnIbjjz3oWUObacn//1Go=
35+
github.com/gorilla/websocket v1.5.4-0.20240702125206-a62d9d2a8413/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
3636
github.com/jeremija/gosubmit v0.2.7 h1:At0OhGCFGPXyjPYAsCchoBUhE099pcBXmsb4iZqROIc=
3737
github.com/jeremija/gosubmit v0.2.7/go.mod h1:Ui+HS073lCFREXBbdfrJzMB57OI/bdxTiLtrDHHhFPI=
3838
github.com/juju/clock v1.0.3 h1:yJHIsWXeU8j3QcBdiess09SzfiXRRrsjKPn2whnMeds=
@@ -112,15 +112,15 @@ go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw
112112
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
113113
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
114114
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
115-
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
116-
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
115+
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
116+
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
117117
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
118118
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
119119
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
120120
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
121121
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
122-
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
123-
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
122+
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
123+
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
124124
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
125125
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
126126
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -134,19 +134,19 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
134134
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
135135
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
136136
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
137-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
138-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
137+
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
138+
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
139139
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
140140
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
141141
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
142-
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
143-
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
142+
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
143+
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
144144
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
145145
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
146146
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
147147
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
148-
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
149-
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
148+
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
149+
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
150150
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
151151
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
152152
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=

main.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package main
77

88
import (
99
"context"
10-
"flag"
1110
"fmt"
1211
"log"
1312
"os"
@@ -24,14 +23,20 @@ var signals = []os.Signal{
2423
syscall.SIGTERM,
2524
}
2625

27-
var version = flag.Bool("version", false, "prints version")
28-
var Version string
26+
var (
27+
// Version is the version of the application
28+
Version = "v0.0.0-unknown"
29+
)
2930

3031
func main() {
31-
flag.Parse()
32-
if *version {
32+
// This is an unofficial command. It will be added into future versions of the
33+
// external provider interface. For now we manually hardcode it here. This is not
34+
// used by GARM itself. It is informative for the user to be able to check the version
35+
// of the provider.
36+
garmCommand := os.Getenv("GARM_COMMAND")
37+
if garmCommand == "GetVersion" {
3338
fmt.Println(Version)
34-
return
39+
os.Exit(0)
3540
}
3641

3742
ctx, stop := signal.NotifyContext(context.Background(), signals...)

scripts/build-static.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
GARM_PROVIDER_NAME=${GARM_PROVIDER_NAME:-garm-provider-lxd}
4+
GARM_SOURCE="/build/$GARM_PROVIDER_NAME"
5+
git config --global --add safe.directory /build/$GARM_PROVIDER_NAME
6+
cd $GARM_SOURCE
7+
8+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
9+
if [ ! -z "$GARM_REF" ] && [ "$GARM_REF" != "$CURRENT_BRANCH" ];then
10+
git checkout $GARM_REF
11+
fi
12+
13+
cd $GARM_SOURCE
14+
15+
OUTPUT_DIR="/build/output"
16+
VERSION=$(git describe --tags --match='v[0-9]*' --dirty --always)
17+
BUILD_DIR="$OUTPUT_DIR/$VERSION"
18+
19+
20+
[ ! -d "$BUILD_DIR/linux" ] && mkdir -p "$BUILD_DIR/linux"
21+
[ ! -d "$BUILD_DIR/windows" ] && mkdir -p "$BUILD_DIR/windows"
22+
23+
export CGO_ENABLED=1
24+
USER_ID=${USER_ID:-$UID}
25+
USER_GROUP=${USER_GROUP:-$(id -g)}
26+
27+
# Garm
28+
cd $GARM_SOURCE
29+
30+
# Linux
31+
GOOS=linux GOARCH=amd64 go build -mod vendor \
32+
-o $BUILD_DIR/linux/amd64/$GARM_PROVIDER_NAME \
33+
-tags osusergo,netgo,sqlite_omit_load_extension \
34+
-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .
35+
GOOS=linux GOARCH=arm64 CC=aarch64-linux-musl-gcc go build \
36+
-mod vendor \
37+
-o $BUILD_DIR/linux/arm64/$GARM_PROVIDER_NAME \
38+
-tags osusergo,netgo,sqlite_omit_load_extension \
39+
-ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" .
40+
41+
# Windows
42+
GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-cc go build -mod vendor \
43+
-o $BUILD_DIR/windows/amd64/$GARM_PROVIDER_NAME.exe \
44+
-tags osusergo,netgo,sqlite_omit_load_extension \
45+
-ldflags "-s -w -X main.Version=$VERSION" .
46+
47+
git checkout $CURRENT_BRANCH || true
48+
chown $USER_ID:$USER_GROUP -R "$OUTPUT_DIR"

scripts/make-release.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
echo $GARM_REF
4+
GARM_PROVIDER_NAME=${GARM_PROVIDER_NAME:-garm-provider-lxd}
5+
6+
VERSION=$(git describe --tags --match='v[0-9]*' --dirty --always)
7+
RELEASE="$PWD/release"
8+
9+
[ ! -d "$RELEASE" ] && mkdir -p "$RELEASE"
10+
11+
if [ ! -z "$GARM_REF" ]; then
12+
VERSION=$(git describe --tags --match='v[0-9]*' --always $GARM_REF)
13+
fi
14+
15+
echo $VERSION
16+
17+
if [ ! -d "build/$VERSION" ]; then
18+
echo "missing build/$VERSION"
19+
exit 1
20+
fi
21+
22+
# Windows
23+
24+
if [ ! -d "build/$VERSION/windows/amd64" ];then
25+
echo "missing build/$VERSION/windows/amd64"
26+
exit 1
27+
fi
28+
29+
if [ ! -f "build/$VERSION/windows/amd64/$GARM_PROVIDER_NAME.exe" ];then
30+
echo "missing build/$VERSION/windows/amd64/$GARM_PROVIDER_NAME.exe"
31+
exit 1
32+
fi
33+
34+
pushd build/$VERSION/windows/amd64
35+
zip $GARM_PROVIDER_NAME-windows-amd64.zip $GARM_PROVIDER_NAME.exe
36+
sha256sum $GARM_PROVIDER_NAME-windows-amd64.zip > $GARM_PROVIDER_NAME-windows-amd64.zip.sha256
37+
mv $GARM_PROVIDER_NAME-windows-amd64.zip $RELEASE
38+
mv $GARM_PROVIDER_NAME-windows-amd64.zip.sha256 $RELEASE
39+
popd
40+
41+
# Linux
42+
OS_ARCHES=("amd64" "arm64")
43+
44+
for arch in ${OS_ARCHES[@]};do
45+
if [ ! -f "build/$VERSION/linux/$arch/$GARM_PROVIDER_NAME" ];then
46+
echo "missing build/$VERSION/linux/$arch/$GARM_PROVIDER_NAME"
47+
exit 1
48+
fi
49+
50+
pushd build/$VERSION/linux/$arch
51+
tar czf $GARM_PROVIDER_NAME-linux-$arch.tgz $GARM_PROVIDER_NAME
52+
sha256sum $GARM_PROVIDER_NAME-linux-$arch.tgz > $GARM_PROVIDER_NAME-linux-$arch.tgz.sha256
53+
mv $GARM_PROVIDER_NAME-linux-$arch.tgz $RELEASE
54+
mv $GARM_PROVIDER_NAME-linux-$arch.tgz.sha256 $RELEASE
55+
popd
56+
done

0 commit comments

Comments
 (0)