Browse Source

add picopublish build script for the greenhouse installer

master
forest 2 months ago
parent
commit
078f12e0aa
2 changed files with 37 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +34
    -0
      picopublish.sh

+ 3
- 0
.gitignore View File

@ -25,3 +25,6 @@ caddy-dist
# IDE files
.idea/
.vscode/
# sequentialread specific files
build/

+ 34
- 0
picopublish.sh View File

@ -0,0 +1,34 @@
#!/bin/bash -e
function build() {
GOOS=$1
GOARCH=$2
tag="0.0.0"
if git describe --tags --abbrev=0 > /dev/null 2>&1 ; then
tag="$(git describe --tags --abbrev=0)"
fi
version="$tag-$(git rev-parse --short HEAD)-$(hexdump -n 2 -ve '1/1 "%.2x"' /dev/urandom)"
echo "building version: $version"
rm -rf build
mkdir build
go build -v -tags 'osusergo netgo' -ldflags='-extldflags=-static' -o build/caddy ./cmd/caddy
sha256sum build/caddy
gzip_file_name="caddy-$version-$GOOS-$GOARCH.gz"
gzip --stdout build/caddy > "build/$gzip_file_name"
curl -X POST "https://picopublish.sequentialread.com/files/$gzip_file_name" \
-H 'Content-Type: application/x-gzip' -H "Authorization: Basic $(cat ~/.picopublish-auth)" \
--data-binary "@build/$gzip_file_name"
echo "https://picopublish.sequentialread.com/files/$gzip_file_name"
}
#build arm
build linux amd64
#build arm64

Loading…
Cancel
Save