Prepare deployment: Build basic deb packages

This commit is contained in:
aldrin 2021-04-16 09:23:01 +02:00
parent 87d72be3fa
commit dde639f3d1
17 changed files with 280 additions and 0 deletions

48
make.d/assets.mk Normal file
View file

@ -0,0 +1,48 @@
DIR_ASSETS = .
DIR_NODE = $(DIR_ASSETS)/node_modules
DIR_NODE_BIN = $(DIR_NODE)/.bin
BIN_NODE_PKG = npm --prefix "$(DIR_ASSETS)"
BIN_VUE_CLI = $(DIR_NODE_BIN)/vue-cli-service
OUTPUT_DIR_STATIC = $(DIR_BUILD)/webapp
OUTPUT_ASSET_TEMPLATE = $(OUTPUT_DIR_STATIC)/index.html
DEPS_ASSETS = $(shell find "$(DIR_ASSETS)" -type f -not -path "$(DIR_ASSETS)/node_modules/*" -not -path "$(DIR_ASSETS)/venv/*")
# dpkg-buildpackage and related tools may interface with
# proxy settings to prevent internet access during package builds.
# We dont care about that.
undefine no_proxy
undefine http_proxy
undefine https_proxy
$(DIR_NODE): $(DIR_ASSETS)/package.json $(DIR_ASSETS)/package-lock.json
ADBLOCK=true $(BIN_NODE_PKG) ci --no-progress
@touch -c $(DIR_NODE)
$(BIN_VUE_CLI): $(DIR_NODE)
$(OUTPUT_ASSET_TEMPLATE): $(BIN_VUE_CLI) $(DEPS_ASSETS)
$(BIN_NODE_PKG) run build
.PHONY: lint-js
lint-js: $(BIN_VUE_CLI)
$(BIN_NODE_PKG) run lint
lint: lint-js
.PHONY: clean-assets
clean-assets:
rm -rf \
$(DIR_NODE) \
$(OUTPUT_DIR_STATIC)
clean: clean-assets
.PHONY: assets
assets: $(OUTPUT_ASSET_TEMPLATE)
.PHONY: assets-install
assets-install: assets
(cd "$(OUTPUT_DIR_STATIC)"; find * -type f -print0 | xargs -0 -I '{}' install -D '{}' "$(DESTDIR)/public/{}")

5
make.d/deb.mk Normal file
View file

@ -0,0 +1,5 @@
PHONY: dist-deb
dist-deb:
dpkg-buildpackage --no-sign
mkdir -p "$(DIR_BUILD)/deb"
mv ../*.deb ../*.changes ../*.buildinfo ../*.git ../*.dsc build/deb

21
make.d/release.mk Normal file
View file

@ -0,0 +1,21 @@
.PHONY: release-ready
release-ready:
@[ -n "$$(git status --porcelain)" ] && echo "working directory must be clean for release" >&2 && exit 1
true
# $(MAKE) test
release-major: BUMP=major
release-minor: BUMP=minor
release-patch: BUMP=patch
.PHONY: release-major release-minor release-patch
release-major release-minor release-patch: release-generic
.PHONY: release-generic
.ONESHELL:
release-generic: release-ready
CURRENT_VERSION="$$(bumpversion --no-commit --no-tag $(BUMP) && cat VERSION)"
debchange --newversion "$${CURRENT_VERSION}-1" "New upstream release"
debchange --release ""
git commit -a -m "Release $${CURRENT_VERSION}"
git tag -m "Release $${CURRENT_VERSION}" "v$${CURRENT_VERSION}"