feat(packaging): add goreleaser recipe

This commit is contained in:
2023-09-22 22:03:28 -06:00
parent fdaffca43f
commit c2f8be504e
8 changed files with 266 additions and 1 deletions

View File

@ -1,6 +1,15 @@
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
@ -34,6 +43,25 @@ 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