add zip build to ci

This commit is contained in:
Robert Nasarek 2026-06-25 10:01:49 +02:00
parent 7b210d5257
commit 9b015f4d9a
4 changed files with 67 additions and 7 deletions

4
.gitignore vendored
View file

@ -19,3 +19,7 @@ node_modules/
/playwright/.auth/ /playwright/.auth/
/viewer/admin/admin.sqlite /viewer/admin/admin.sqlite
# release artifacts (built in CI; download from project Releases)
/dfg-3dviewer-library.zip
/dfg_3dviewer-dist.zip

41
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,41 @@
stages:
- build
- release
.build-base:
image: node:24-bookworm
before_script:
- apt-get update -qq && apt-get install -y -qq zip
rules:
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "web"
build-library:
extends: .build-base
stage: build
script:
- npm ci
- npm run build:library
- node ./scripts/pack-library.js
artifacts:
paths:
- dfg-3dviewer-library.zip
expire_in: 4 weeks
release-library:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: build-library
artifacts: true
rules:
- if: $CI_COMMIT_TAG
script:
- echo "Publishing release $CI_COMMIT_TAG"
release:
tag_name: $CI_COMMIT_TAG
name: Release $CI_COMMIT_TAG
assets:
paths:
- path: dfg-3dviewer-library.zip
name: dfg-3dviewer-library.zip

View file

@ -2,21 +2,36 @@
Three.js-based 3D viewer. Ships as a minified bundle for `web/libraries/dfg-3dviewer/` or standalone HTML embeds. Three.js-based 3D viewer. Ships as a minified bundle for `web/libraries/dfg-3dviewer/` or standalone HTML embeds.
**Drupal integration** is provided by the separate [`dfg_3dviewer`](https://github.com/your-org/dfg_3dviewer) module. **Drupal integration** is provided by the separate [`dfg_3dviewer`](https://gitlab.nasarek.dev/rnsrk/dfg_3dviewer_drupal_module) module.
## Build ## Build
```bash ```bash
npm install npm install
npm run build:library npm run build:library
npm run pack:library
``` ```
Output: Output in `dist/library/`:
- `dist/library/dfg_3dviewer.min.js` - `dfg_3dviewer.min.js`
- `dist/library/assets/` — CSS, draco, IFC WASM, fonts - `assets/` — CSS, draco, IFC WASM, fonts
- `dfg-3dviewer-library.zip` — extract to `web/libraries/dfg-3dviewer/` on Drupal
For local packaging (optional):
```bash
npm run pack:library # creates dfg-3dviewer-library.zip (gitignored)
```
## Releases
Tagged pushes build `dfg-3dviewer-library.zip` in CI and attach it to a GitLab Release.
```bash
git tag v1.0.3
git push origin v1.0.3
```
Download the zip from [Releases](https://gitlab.nasarek.dev/rnsrk/dfg_3dviewer_js_library/-/releases) and extract to `web/libraries/dfg-3dviewer/` on Drupal.
## Local development ## Local development
@ -28,7 +43,7 @@ npm run dev:test
## Install on Drupal ## Install on Drupal
1. Extract `dfg-3dviewer-library.zip` to `web/libraries/dfg-3dviewer/` 1. Download `dfg-3dviewer-library.zip` from [Releases](https://gitlab.nasarek.dev/rnsrk/dfg_3dviewer_js_library/-/releases) and extract to `web/libraries/dfg-3dviewer/`
2. Enable the `dfg_3dviewer` Drupal module and configure at `/admin/config/dfg_3dviewer` 2. Enable the `dfg_3dviewer` Drupal module and configure at `/admin/config/dfg_3dviewer`
## Standalone embed ## Standalone embed

Binary file not shown.