retold-facto 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish-image.yml +66 -0
- package/BUILDING-AND-PUBLISHING.md +140 -0
- package/Dockerfile +5 -2
- package/package.json +15 -5
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Publish a container image to GitHub Container Registry on every
|
|
2
|
+
# version tag push (e.g. `v1.2.3`). Generated by `quack docker-init`.
|
|
3
|
+
#
|
|
4
|
+
# Image lands at:
|
|
5
|
+
# ghcr.io/stevenvelozo/retold-facto:<version>
|
|
6
|
+
# ghcr.io/stevenvelozo/retold-facto:latest (only on stable tags)
|
|
7
|
+
|
|
8
|
+
name: Publish container image
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
tags:
|
|
13
|
+
- 'v*.*.*'
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
inputs:
|
|
16
|
+
tag:
|
|
17
|
+
description: 'Tag to apply (e.g. dev or 1.2.3-test). `latest` is reserved for stable tag pushes.'
|
|
18
|
+
required: true
|
|
19
|
+
default: 'dev'
|
|
20
|
+
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
packages: write
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
build-and-push:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
|
|
32
|
+
- name: Set up QEMU (multi-arch support)
|
|
33
|
+
uses: docker/setup-qemu-action@v3
|
|
34
|
+
|
|
35
|
+
- name: Set up Docker Buildx
|
|
36
|
+
uses: docker/setup-buildx-action@v3
|
|
37
|
+
|
|
38
|
+
- name: Log in to GHCR
|
|
39
|
+
uses: docker/login-action@v3
|
|
40
|
+
with:
|
|
41
|
+
registry: ghcr.io
|
|
42
|
+
username: ${{ github.actor }}
|
|
43
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
44
|
+
|
|
45
|
+
- name: Compute image tags
|
|
46
|
+
id: meta
|
|
47
|
+
uses: docker/metadata-action@v5
|
|
48
|
+
with:
|
|
49
|
+
images: ghcr.io/${{ github.repository_owner }}/retold-facto
|
|
50
|
+
tags: |
|
|
51
|
+
type=semver,pattern={{version}}
|
|
52
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
53
|
+
type=semver,pattern={{major}}
|
|
54
|
+
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
|
55
|
+
|
|
56
|
+
- name: Build and push
|
|
57
|
+
uses: docker/build-push-action@v5
|
|
58
|
+
with:
|
|
59
|
+
context: .
|
|
60
|
+
file: ./Dockerfile
|
|
61
|
+
platforms: linux/amd64,linux/arm64
|
|
62
|
+
push: true
|
|
63
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
64
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
65
|
+
cache-from: type=gha
|
|
66
|
+
cache-to: type=gha,mode=max
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Building and Publishing
|
|
2
|
+
|
|
3
|
+
How to ship `retold-facto` to npm and to GitHub Container Registry
|
|
4
|
+
(GHCR). Generated by `quack docker-init`; the structure matches the
|
|
5
|
+
shared template across all dockerized retold tools.
|
|
6
|
+
|
|
7
|
+
`retold-facto` is a **long-running service**. Restart policy in compose / k8s should be `unless-stopped` (or equivalent). The Dockerfile should declare a HEALTHCHECK against the service's health endpoint.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## TL;DR
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# npm-only release (the default — most common case)
|
|
15
|
+
npm run release:patch
|
|
16
|
+
|
|
17
|
+
# npm release that ALSO rebuilds the GHCR image
|
|
18
|
+
npm run release:patch:image
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The default release is npm-only. Docker images are deliberate, opt-in
|
|
22
|
+
artifacts because each multi-arch build burns several minutes of CI
|
|
23
|
+
time. Use `:image` (or set `BUILD_DOCKER=1`) when runtime code,
|
|
24
|
+
dependencies, env-var contract, or the Dockerfile changed.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Prerequisites (one-time setup)
|
|
29
|
+
|
|
30
|
+
- **npm login** — `npm whoami` should print your username.
|
|
31
|
+
- **Git remote configured** — `git remote get-url origin` should print
|
|
32
|
+
`git@github.com:stevenvelozo/retold-facto.git` (or the
|
|
33
|
+
HTTPS equivalent).
|
|
34
|
+
- **Push access to the repo** — required so `postversion` /
|
|
35
|
+
`postpublish` hooks can push commits and tags.
|
|
36
|
+
- **Docker** (only if you want to test the image locally before tag).
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Ecosystem convention: lockfiles are gitignored
|
|
41
|
+
|
|
42
|
+
`package-lock.json` is in this repo's `.gitignore` (Quackage convention
|
|
43
|
+
shared across the retold ecosystem). The Dockerfile must use `npm install`,
|
|
44
|
+
not `npm ci` — `npm ci` requires the lockfile to be in the build context
|
|
45
|
+
and CI runners only check out what's in git. If you see EUSAGE errors in
|
|
46
|
+
GHCR build logs, change `RUN npm ci` to `RUN npm install` in the
|
|
47
|
+
Dockerfile.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Releasing
|
|
52
|
+
|
|
53
|
+
| Command | npm registry | GHCR image rebuild |
|
|
54
|
+
|--------------------------------------|--------------|--------------------|
|
|
55
|
+
| `npm run release:patch` | yes | no |
|
|
56
|
+
| `npm run release:patch:image` | yes | yes |
|
|
57
|
+
| `npm run release:minor` | yes | no |
|
|
58
|
+
| `npm run release:minor:image` | yes | yes |
|
|
59
|
+
| `npm run release:major` | yes | no |
|
|
60
|
+
| `npm run release:major:image` | yes | yes |
|
|
61
|
+
|
|
62
|
+
The non-`:image` variants are the default because most patch releases
|
|
63
|
+
don't change runtime behavior. The `:image` variants tell the pipeline
|
|
64
|
+
"this release does change runtime — build me a new image."
|
|
65
|
+
|
|
66
|
+
### Direct CLI (also works)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm publish # npm only
|
|
70
|
+
npm run publish:docker # npm + docker (sets BUILD_DOCKER=1)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### From `retold-manager` TUI
|
|
74
|
+
|
|
75
|
+
- `[!]` Publish — npm only
|
|
76
|
+
- `[D]` Publish with docker image — npm + GHCR build
|
|
77
|
+
|
|
78
|
+
### Promoting a previous npm release to docker later
|
|
79
|
+
|
|
80
|
+
If you released `v<x>` to npm only, then later decide you do want a
|
|
81
|
+
docker image:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git push origin v<x> # pushes the local tag → GHCR fires
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The local tag is still sitting there from the original `npm version`
|
|
88
|
+
step. Pushing it triggers the workflow without touching npm.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## The chain
|
|
93
|
+
|
|
94
|
+
The lifecycle hooks all live in `package.json` and delegate to
|
|
95
|
+
`npx quack release …`. Default path (`BUILD_DOCKER` unset):
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
npm publish
|
|
99
|
+
→ prepublishOnly: npm test ← test gate
|
|
100
|
+
→ publish to npm
|
|
101
|
+
→ postpublish: BUILD_DOCKER unset → no-op ← image NOT triggered
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Docker-included path (`BUILD_DOCKER=1`):
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
BUILD_DOCKER=1 npm publish (or: npm run publish:docker)
|
|
108
|
+
→ prepublishOnly: npm test
|
|
109
|
+
→ publish to npm
|
|
110
|
+
→ postpublish: BUILD_DOCKER=1 → tag + push ← image trigger
|
|
111
|
+
→ .github/workflows/publish-image.yml fires
|
|
112
|
+
→ docker buildx build linux/amd64,linux/arm64
|
|
113
|
+
→ docker push ghcr.io/stevenvelozo/retold-facto:<version>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Verifying a release
|
|
119
|
+
|
|
120
|
+
1. **npm**: `npm view retold-facto version`
|
|
121
|
+
2. **Workflow**: `https://github.com/stevenvelozo/retold-facto/actions`
|
|
122
|
+
3. **Image**: `docker pull ghcr.io/stevenvelozo/retold-facto:latest`
|
|
123
|
+
|
|
124
|
+
If the first `docker pull` returns `denied`, the package is private by
|
|
125
|
+
default — flip visibility to public via Package Settings → Danger Zone
|
|
126
|
+
on the package page.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Image consumption
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
docker pull ghcr.io/stevenvelozo/retold-facto:latest
|
|
134
|
+
docker run --rm ghcr.io/stevenvelozo/retold-facto:latest
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Configuration via env vars: see this module's README for the supported
|
|
138
|
+
`<MODULE>_*` variables. Any secret-bearing var also accepts `<NAME>_FILE`
|
|
139
|
+
pointing at a file whose contents become the value (mysql/postgres
|
|
140
|
+
convention; works with docker secrets and k8s Secrets).
|
package/Dockerfile
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
FROM node:20-slim AS builder
|
|
3
3
|
WORKDIR /app
|
|
4
4
|
COPY package*.json ./
|
|
5
|
-
|
|
5
|
+
# `npm install`, not `npm ci` — package-lock.json is gitignored per
|
|
6
|
+
# the Quackage convention shared across the retold ecosystem, so the
|
|
7
|
+
# build context never has it. See BUILDING-AND-PUBLISHING.md.
|
|
8
|
+
RUN npm install
|
|
6
9
|
COPY .quackage.json ./
|
|
7
10
|
COPY source/ source/
|
|
8
11
|
COPY bin/ bin/
|
|
@@ -16,7 +19,7 @@ RUN cp node_modules/pict/dist/pict.min.js source/services/web-app/web/pict.min.j
|
|
|
16
19
|
FROM node:20-slim
|
|
17
20
|
WORKDIR /app
|
|
18
21
|
COPY package*.json ./
|
|
19
|
-
RUN npm
|
|
22
|
+
RUN npm install --omit=dev
|
|
20
23
|
COPY --from=builder /app/source/ source/
|
|
21
24
|
COPY --from=builder /app/bin/ bin/
|
|
22
25
|
COPY --from=builder /app/test/model/ test/model/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "retold-facto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Data warehouse and knowledge graph storage for the Retold ecosystem.",
|
|
5
5
|
"main": "source/Retold-Facto.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,17 @@
|
|
|
15
15
|
"build-codemirror": "npx esbuild source/services/web-app/codemirror-entry.js --bundle --outfile=source/services/web-app/web/codemirror-bundle.js --format=iife --global-name=CodeMirrorModules --platform=browser --target=es2018",
|
|
16
16
|
"build-test-model": "cd test && npx stricture -i model/ddl/Facto.ddl",
|
|
17
17
|
"docker-build": "docker build -t retold-facto .",
|
|
18
|
-
"docker-run": "docker run -p 8386:8386 retold-facto"
|
|
18
|
+
"docker-run": "docker run -p 8386:8386 retold-facto",
|
|
19
|
+
"prepublishOnly": "npm test",
|
|
20
|
+
"postversion": "npx quack release postversion",
|
|
21
|
+
"postpublish": "npx quack release postpublish",
|
|
22
|
+
"publish:docker": "npx quack release publish --image",
|
|
23
|
+
"release:patch": "npx quack release patch",
|
|
24
|
+
"release:minor": "npx quack release minor",
|
|
25
|
+
"release:major": "npx quack release major",
|
|
26
|
+
"release:patch:image": "npx quack release patch --image",
|
|
27
|
+
"release:minor:image": "npx quack release minor --image",
|
|
28
|
+
"release:major:image": "npx quack release major --image"
|
|
19
29
|
},
|
|
20
30
|
"mocha": {
|
|
21
31
|
"spec": "test/RetoldFacto_tests.js",
|
|
@@ -96,7 +106,7 @@
|
|
|
96
106
|
"chai": "^6.2.2",
|
|
97
107
|
"pict-docuserve": "^0.1.5",
|
|
98
108
|
"puppeteer": "^24.40.0",
|
|
99
|
-
"quackage": "^1.
|
|
109
|
+
"quackage": "^1.2.0",
|
|
100
110
|
"stricture": "^4.0.2",
|
|
101
111
|
"supertest": "^7.2.2"
|
|
102
112
|
},
|
|
@@ -115,12 +125,12 @@
|
|
|
115
125
|
"meadow-connection-mysql": "^1.0.18",
|
|
116
126
|
"meadow-endpoints": "^4.0.17",
|
|
117
127
|
"meadow-integration": "^1.0.38",
|
|
118
|
-
"orator": "^6.1.
|
|
128
|
+
"orator": "^6.1.1",
|
|
119
129
|
"orator-serviceserver-restify": "^2.0.10",
|
|
120
130
|
"orator-static-server": "^2.1.3",
|
|
121
131
|
"pict": "^1.0.365",
|
|
122
132
|
"pict-router": "^1.0.9",
|
|
123
|
-
"pict-section-connection-form": "^0.0.
|
|
133
|
+
"pict-section-connection-form": "^0.0.2",
|
|
124
134
|
"pict-section-flow": "^0.0.17",
|
|
125
135
|
"pict-section-histogram": "^1.0.0",
|
|
126
136
|
"pict-section-markdowneditor": "^1.0.10",
|