SHELL := /bin/bash DOKKU_URL := dokku@dev.lookingfora.name:rebound GORELEASER_VERSION ?= v1.13.1 GORELEASER_ARGS ?= release --snapshot --clean MKT_GITEA_RELEASE_ORG ?= wpetit MKT_GITEA_RELEASE_PROJECT ?= rebound MKT_GITEA_RELEASE_VERSION ?= $(MKT_PROJECT_VERSION) DEPLOY_TARGET ?= root@cadoles-rebound all: build watch: tools/modd/bin/modd tools/modd/bin/modd socks: mkdir -p ./socks run: .env socks ( set -o allexport && source .env && set +o allexport && bin/server ) build: .env CGO_ENABLED=0 go build -o ./bin/server ./cmd/server .env: cp .env.dist .env dokku-build: docker build \ -t rebound-dokku:latest \ . dokku-run: docker run \ -it --rm \ -p 2222:2222 \ --tmpfs /socks \ rebound-dokku:latest dokku-deploy: $(if $(shell git config remote.dokku.url),, git remote add dokku $(DOKKU_URL)) git push -f dokku $(shell git rev-parse HEAD):refs/heads/master .PHONY: dist dist: .mktools ( set -o allexport && source .env && set +o allexport && VERSION=$(GORELEASER_VERSION) curl -sfL https://goreleaser.com/static/run | GORELEASER_CURRENT_TAG="$(MKT_PROJECT_VERSION)" bash /dev/stdin $(GORELEASER_ARGS) ) .PHONY: release release: changelog $(MAKE) MKT_GITEA_RELEASE_ATTACHMENTS="$$(find dist/* -type f -name '*.apk' -or -name '*.deb' -or -name '*.rpm' -or -name 'checksums.txt' -or -name 'CHANGELOG.md' | tr '\n' ' ')" mkt-gitea-release .PHONY: changelog changelog: .mktools $(MAKE) MKT_GIT_CHGLOG_ARGS='--next-tag $(MKT_PROJECT_VERSION) --tag-filter-pattern $(MKT_PROJECT_VERSION_CHANNEL) --output CHANGELOG.md' mkt-changelog .PHONY: deploy deploy: dist FILE=$$(find ./dist -name '*amd64.deb') \ && ssh $(DEPLOY_TARGET) rm -f ~/rebound_*amd64.deb \ && scp $${FILE} $(DEPLOY_TARGET):~/ \ && ssh $(DEPLOY_TARGET) dpkg -i $$(basename $${FILE}) .PHONY: mktools mktools: rm -rf .mktools curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL) tools/modd/bin/modd: mkdir -p tools/modd/bin GOBIN=$(PWD)/tools/modd/bin go install github.com/cortesi/modd/cmd/modd@v0.8.1 .mktools: $(MAKE) mktools -include .mktools/*.mk