build: package prebuilt frontend assets as webdist tarball (#768)

* build: package prebuilt frontend assets as webdist tarball

OpenGist relies on a complex nodejs + tailwind toolchain that's not
available on all platforms, lacking native bindings.

Add a webdist release artefact that contains the platform-independent
frontend assets, suitable for embedding.

Add Github actions to prepare the release artefacts in CI.

* Nits

---------

Co-authored-by: Thomas Miceli <tho.miceli@gmail.com>
This commit is contained in:
Dave Cottlehuber
2026-07-21 02:35:59 +02:00
committed by GitHub
parent addefa38bd
commit ee5dbf6459
2 changed files with 23 additions and 3 deletions
+5 -2
View File
@@ -26,12 +26,15 @@ jobs:
- name: Cross compile build - name: Cross compile build
run: make all_crosscompile run: make all_crosscompile
- name: Package frontend assets
run: make package_webdist
- name: Upload Release Assets - name: Upload Release Assets
uses: softprops/action-gh-release@v3 uses: softprops/action-gh-release@v3
with: with:
files: | files: |
build/*.tar.gz build/*.tar.gz
build/*.zip build/*.zip
build/checksums.txt build/checksums.txt
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+18 -1
View File
@@ -1,8 +1,9 @@
.PHONY: all all_crosscompile install build_frontend build_backend build build_crosscompile build_docker build_dev_docker run_dev_docker watch_frontend watch_backend watch clean clean_docker check_changes go_mod fmt test check-tr update_js_deps update_go_deps .PHONY: all all_crosscompile install build_frontend build_backend build build_crosscompile build_webdist package_webdist build_docker build_dev_docker run_dev_docker watch_frontend watch_backend watch clean clean_docker check_changes go_mod fmt test check-tr update_js_deps update_go_deps
# Specify the name of your Go binary output # Specify the name of your Go binary output
BINARY_NAME := opengist BINARY_NAME := opengist
GIT_TAG := $(shell git describe --tags) GIT_TAG := $(shell git describe --tags)
VERSION := $(patsubst v%,%,$(GIT_TAG))
VERSION_PKG := github.com/thomiceli/opengist/internal/config.OpengistVersion VERSION_PKG := github.com/thomiceli/opengist/internal/config.OpengistVersion
TEST_DB_TYPE ?= sqlite TEST_DB_TYPE ?= sqlite
@@ -29,6 +30,22 @@ build: build_frontend build_backend
build_crosscompile: build_crosscompile:
@bash ./scripts/build-all.sh @bash ./scripts/build-all.sh
# Package the built, platform-independent frontend assets (the files embedded
# via //go:embed in public/fs_embed.go) into a tarball. Downstream packagers
# (e.g. distro ports) can fetch this instead of running the npm/vite toolchain.
# Use build_webdist to build assets first; package_webdist assumes they exist.
build_webdist: build_frontend package_webdist
package_webdist:
@test -f public/.vite/manifest.json || (echo "Error: frontend assets not found in public/. Run 'make build_frontend' first." && exit 1)
@echo "Packaging frontend assets into build/$(BINARY_NAME)$(VERSION)-webdist.tar.gz..."
@mkdir -p build
@tar -czf "build/$(BINARY_NAME)$(VERSION)-webdist.tar.gz" \
--transform 's,^,$(BINARY_NAME)-webdist/,' \
-C public .vite/manifest.json assets
@sha256sum "build/$(BINARY_NAME)$(VERSION)-webdist.tar.gz" | awk '{print $$1 " " substr($$2,7)}' >> build/checksums.txt
@echo "Done."
build_docker: build_docker:
@echo "Building Docker image..." @echo "Building Docker image..."
docker build -t $(BINARY_NAME):latest . docker build -t $(BINARY_NAME):latest .