Package and ship frontend independenlty (#2893)

Enable frontend consumption by downstreams, like debian and nixos

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
This commit is contained in:
Julien Pivotto 2022-04-22 12:07:11 +02:00 committed by GitHub
parent 71d61c9c91
commit 74ebd3d175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View File

@ -36,6 +36,13 @@ jobs:
- run: git diff --exit-code - run: git diff --exit-code
- store_test_results: - store_test_results:
path: ~/test-results path: ~/test-results
- run:
name: Save assets
command: make assets-tarball
- persist_to_workspace:
root: .
paths:
- .tarballs
test: test:
docker: docker:
# Whenever the Go version is updated here, .promu.yml should also be updated. # Whenever the Go version is updated here, .promu.yml should also be updated.

View File

@ -29,6 +29,10 @@ build-all: assets apiv2 build
.PHONY: assets .PHONY: assets
assets: asset/assets_vfsdata.go 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 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 GO111MODULE=$(GO111MODULE) $(GO) generate $(GOOPTS) ./asset
@$(GOFMT) -w ./asset @$(GOFMT) -w ./asset

9
scripts/package_assets.sh Executable file
View File

@ -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