From 74ebd3d1758936842d16ed470617a6b0f924f94c Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 22 Apr 2022 12:07:11 +0200 Subject: [PATCH] Package and ship frontend independenlty (#2893) Enable frontend consumption by downstreams, like debian and nixos Signed-off-by: Julien Pivotto --- .circleci/config.yml | 7 +++++++ Makefile | 4 ++++ scripts/package_assets.sh | 9 +++++++++ 3 files changed, 20 insertions(+) create mode 100755 scripts/package_assets.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 32d6f693..79bdb6f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,6 +36,13 @@ jobs: - run: git diff --exit-code - store_test_results: path: ~/test-results + - run: + name: Save assets + command: make assets-tarball + - persist_to_workspace: + root: . + paths: + - .tarballs test: docker: # Whenever the Go version is updated here, .promu.yml should also be updated. diff --git a/Makefile b/Makefile index 16db86c5..df11e27b 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,10 @@ build-all: assets apiv2 build .PHONY: assets assets: asset/assets_vfsdata.go +.PHONY: assets-tarball +assets-tarball: ui/app/script.js ui/app/index.html + scripts/package_assets.sh + asset/assets_vfsdata.go: ui/app/script.js ui/app/index.html ui/app/lib template/default.tmpl template/email.tmpl GO111MODULE=$(GO111MODULE) $(GO) generate $(GOOPTS) ./asset @$(GOFMT) -w ./asset diff --git a/scripts/package_assets.sh b/scripts/package_assets.sh new file mode 100755 index 00000000..f9a62e39 --- /dev/null +++ b/scripts/package_assets.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# +# compress static assets + +set -euo pipefail + +version="$(< VERSION)" +mkdir -p .tarballs +tar czf .tarballs/alertmanager-web-ui-${version}.tar.gz ui/app/script.js ui/app/index.html