Compare commits
No commits in common. "b51037859b6d40c9acab6e0fe5805fa4c6f4a7bf" and "3652ce9fad061149c55d723c031f37d77c7f7181" have entirely different histories.
b51037859b
...
3652ce9fad
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,6 +1,5 @@
|
||||||
# bin
|
# bin
|
||||||
shout
|
shout
|
||||||
dist/
|
|
||||||
|
|
||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
*.exe
|
*.exe
|
||||||
|
|
|
||||||
36
Makefile
36
Makefile
|
|
@ -1,12 +1,7 @@
|
||||||
.PHONY: build test unit integration clean dist release
|
.PHONY: build test unit integration clean
|
||||||
|
|
||||||
VERSION ?= $(shell git describe --tags --always --dirty)
|
|
||||||
LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION)"
|
|
||||||
GITEA_URL := https://git.nose.space
|
|
||||||
REPO := defunkt/go-shout
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build $(LDFLAGS) -o shout .
|
go build -o shout .
|
||||||
|
|
||||||
test: unit integration
|
test: unit integration
|
||||||
|
|
||||||
|
|
@ -18,33 +13,6 @@ integration: build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f shout
|
rm -f shout
|
||||||
rm -rf dist
|
|
||||||
|
|
||||||
dist: clean
|
|
||||||
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o dist/shout-darwin-arm64 .
|
|
||||||
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o dist/shout-linux-amd64 .
|
|
||||||
|
|
||||||
release: dist
|
|
||||||
@test -n "$(TAG)" || (echo "usage: make release TAG=v0.1.0" && exit 1)
|
|
||||||
git tag $(TAG)
|
|
||||||
git push origin $(TAG)
|
|
||||||
@echo "Creating release $(TAG)..."
|
|
||||||
@RELEASE_ID=$$(curl -sf \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token $${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"tag_name":"$(TAG)","name":"$(TAG)"}' \
|
|
||||||
"$(GITEA_URL)/api/v1/repos/$(REPO)/releases" | \
|
|
||||||
python3 -c "import sys,json; print(json.load(sys.stdin)['id'])") && \
|
|
||||||
for f in dist/shout-*; do \
|
|
||||||
echo "Uploading $$f..."; \
|
|
||||||
curl -sf \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token $${GITEA_TOKEN}" \
|
|
||||||
-F "attachment=@$$f" \
|
|
||||||
"$(GITEA_URL)/api/v1/repos/$(REPO)/releases/$$RELEASE_ID/assets?name=$$(basename $$f)" > /dev/null; \
|
|
||||||
done
|
|
||||||
@echo "Released $(TAG): $(GITEA_URL)/$(REPO)/releases/tag/$(TAG)"
|
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
sudo cp ./shout /usr/local/bin
|
sudo cp ./shout /usr/local/bin
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ Write `.shout` files that look like shell sessions and run `shout` to test 'em.
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```
|
```
|
||||||
curl -fsSL https://because.sh/shout | sh
|
git clone https://git.nose.space/defunkt/go-shout
|
||||||
|
cd go-shout
|
||||||
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
|
||||||
46
install.sh
46
install.sh
|
|
@ -1,46 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
REPO="defunkt/go-shout"
|
|
||||||
GITEA_URL="https://git.nose.space"
|
|
||||||
INSTALL_DIR="/usr/local/bin"
|
|
||||||
|
|
||||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
||||||
ARCH=$(uname -m)
|
|
||||||
|
|
||||||
case "$ARCH" in
|
|
||||||
x86_64|amd64) ARCH="amd64" ;;
|
|
||||||
arm64|aarch64) ARCH="arm64" ;;
|
|
||||||
*) echo "Unsupported architecture: $ARCH" && exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
BINARY="shout-${OS}-${ARCH}"
|
|
||||||
|
|
||||||
# Get latest release tag
|
|
||||||
TAG=$(curl -sf "${GITEA_URL}/api/v1/repos/${REPO}/releases/latest" | \
|
|
||||||
grep -o '"tag_name":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
||||||
|
|
||||||
if [ -z "$TAG" ]; then
|
|
||||||
echo "Error: could not find latest release"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing shout ${TAG}..."
|
|
||||||
|
|
||||||
curl -sfL "${GITEA_URL}/${REPO}/releases/download/${TAG}/${BINARY}" -o shout
|
|
||||||
|
|
||||||
if [ ! -s shout ]; then
|
|
||||||
echo "Error: no binary available for ${OS}/${ARCH}"
|
|
||||||
rm -f shout
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod +x shout
|
|
||||||
|
|
||||||
if [ -w "$INSTALL_DIR" ]; then
|
|
||||||
mv shout "${INSTALL_DIR}/shout"
|
|
||||||
else
|
|
||||||
sudo mv shout "${INSTALL_DIR}/shout"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installed shout ${TAG} to ${INSTALL_DIR}/shout"
|
|
||||||
Loading…
Reference in New Issue
Block a user