diff --git a/.gitignore b/.gitignore index a086a7f..29f8cc8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ node_modules/ /playwright/.auth/ /viewer/admin/admin.sqlite + +# release artifacts (built in CI; download from project Releases) +/dfg-3dviewer-library.zip +/dfg_3dviewer-dist.zip diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..568a58d --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/README.md b/README.md index 96236ae..8d5c52d 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,36 @@ 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 ```bash npm install npm run build:library -npm run pack:library ``` -Output: +Output in `dist/library/`: -- `dist/library/dfg_3dviewer.min.js` -- `dist/library/assets/` — CSS, draco, IFC WASM, fonts -- `dfg-3dviewer-library.zip` — extract to `web/libraries/dfg-3dviewer/` on Drupal +- `dfg_3dviewer.min.js` +- `assets/` — CSS, draco, IFC WASM, fonts + +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 @@ -28,7 +43,7 @@ npm run dev:test ## 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` ## Standalone embed diff --git a/dfg-3dviewer-library.zip b/dfg-3dviewer-library.zip deleted file mode 100644 index e43969e..0000000 Binary files a/dfg-3dviewer-library.zip and /dev/null differ