emailengine-app 2.81.1 → 2.82.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/.ncurc.js +12 -6
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +52 -0
- package/Dockerfile +4 -2
- package/bin/emailengine.js +28 -18
- package/config/default.toml +0 -5
- package/config/test.toml +0 -5
- package/data/google-crawlers.json +1 -1
- package/encrypt.js +70 -42
- package/getswagger.sh +0 -4
- package/lib/account/account-state.js +2 -110
- package/lib/account/bounce-store-sweep.js +63 -0
- package/lib/account/expected-identity.js +1 -1
- package/lib/account-assignment.js +207 -0
- package/lib/account.js +374 -878
- package/lib/api-reference/index.js +2 -3
- package/lib/api-reference/schema-tree.js +53 -3
- package/lib/api-routes/account-routes.js +18 -29
- package/lib/api-routes/blocklist-routes.js +2 -2
- package/lib/api-routes/bull-board-routes.js +1 -6
- package/lib/api-routes/export-routes.js +2 -22
- package/lib/api-routes/gateway-routes.js +5 -14
- package/lib/api-routes/index.js +1 -13
- package/lib/api-routes/mailbox-routes.js +2 -7
- package/lib/api-routes/mcp-oauth-routes.js +2 -1
- package/lib/api-routes/mcp-routes.js +7 -7
- package/lib/api-routes/message-routes.js +44 -236
- package/lib/api-routes/mint-bounds.js +110 -0
- package/lib/api-routes/oauth2-app-routes.js +23 -32
- package/lib/api-routes/operation-impact.js +1 -1
- package/lib/api-routes/outbox-routes.js +2 -2
- package/lib/api-routes/permission-map.js +1 -7
- package/lib/api-routes/route-helpers.js +11 -5
- package/lib/api-routes/settings-routes.js +19 -19
- package/lib/api-routes/stats-routes.js +1 -1
- package/lib/api-routes/submit-routes.js +17 -18
- package/lib/api-routes/template-routes.js +4 -9
- package/lib/api-routes/token-routes.js +27 -5
- package/lib/api-token-scheme.js +71 -0
- package/lib/arf-detect.js +41 -7
- package/lib/auth-token.js +44 -24
- package/lib/autodetect-imap-settings.js +163 -123
- package/lib/bounce-detect.js +25 -16
- package/lib/calendar-event.js +78 -0
- package/lib/consts.js +51 -5
- package/lib/create-imap-client.js +24 -0
- package/lib/db.js +76 -17
- package/lib/delivery-error.js +2 -1
- package/lib/egress-fetch.js +54 -3
- package/lib/egress-filter.js +11 -0
- package/lib/email-client/api-retry.js +147 -0
- package/lib/email-client/base-client.js +628 -615
- package/lib/email-client/gmail/gmail-api.js +38 -125
- package/lib/email-client/gmail/send-request.js +1 -1
- package/lib/email-client/gmail-client.js +170 -84
- package/lib/email-client/imap/mailbox.js +244 -535
- package/lib/email-client/imap/stale-view.js +109 -0
- package/lib/email-client/imap/subconnection.js +46 -9
- package/lib/email-client/imap/sync-operations.js +5 -37
- package/lib/email-client/imap-client.js +188 -64
- package/lib/email-client/message-builder.js +9 -14
- package/lib/email-client/notification-handler.js +5 -219
- package/lib/email-client/outlook/graph-api.js +147 -126
- package/lib/email-client/outlook/send-request.js +10 -4
- package/lib/email-client/outlook-client.js +519 -617
- package/lib/email-client/smtp-pool-manager.js +3 -2
- package/lib/encrypt.js +184 -19
- package/lib/enum-descriptions.js +1 -2
- package/lib/export.js +144 -41
- package/lib/gateway.js +20 -6
- package/lib/get-raw-email.js +26 -44
- package/lib/handlebars-helpers.js +31 -10
- package/lib/imap-proxy-auth.js +13 -29
- package/lib/imapproxy/imap-core/README.md +1 -0
- package/lib/imapproxy/imap-core/lib/handler/imap-parser.js +12 -0
- package/lib/imapproxy/imap-core/lib/imap-command.js +74 -10
- package/lib/imapproxy/imap-core/lib/imap-connection.js +9 -1
- package/lib/imapproxy/imap-core/lib/imap-server.js +112 -26
- package/lib/imapproxy/imap-core/lib/imap-stream.js +41 -1
- package/lib/imapproxy/imap-core/lib/imap-tools.js +10 -2
- package/lib/imapproxy/imap-core/lib/indexer/indexer.js +4 -2
- package/lib/imapproxy/imap-server.js +17 -177
- package/lib/imapproxy/proxy-handoff.js +235 -0
- package/lib/imapproxy/response-error.js +33 -0
- package/lib/imapproxy/upstream-client.js +2 -2
- package/lib/license-beacon.js +3 -9
- package/lib/llm-pre-process.js +182 -43
- package/lib/logger.js +1 -1
- package/lib/lua/ee-export-queue-add.lua +39 -0
- package/lib/lua/ee-get-idempotency.lua +15 -3
- package/lib/lua/ee-release-attempts.lua +23 -0
- package/lib/lua/ee-reserve-attempts.lua +42 -0
- package/lib/lua/h-set-bigger.lua +12 -2
- package/lib/lua/s-list-accounts.lua +6 -3
- package/lib/mcp/index.js +1 -2
- package/lib/mcp/listen.js +221 -18
- package/lib/mcp/oauth.js +44 -5
- package/lib/mcp/resources.js +8 -2
- package/lib/mcp/tools.js +13 -0
- package/lib/message-port-stream.js +64 -6
- package/lib/msgpack.js +1 -6
- package/lib/oauth/external-account-signer.js +16 -13
- package/lib/oauth/gmail.js +22 -20
- package/lib/oauth/outlook.js +19 -16
- package/lib/oauth/pubsub/google.js +38 -2
- package/lib/oauth/scope-checker.js +4 -7
- package/lib/oauth/verify-app.js +2 -2
- package/lib/oauth2-apps.js +139 -44
- package/lib/openapi/build-document.js +1 -1
- package/lib/openapi/joi-schema.js +78 -9
- package/lib/parse-message.js +21 -0
- package/lib/payload-examples-webhooks.json +4 -7
- package/lib/pbkdf2-phc.js +101 -0
- package/lib/privileged-settings.js +0 -14
- package/lib/rate-limit.js +54 -15
- package/lib/redis-scan-delete.js +56 -29
- package/lib/redis-url.js +3 -1
- package/lib/respawn-backoff.js +5 -4
- package/lib/response-stream.js +25 -4
- package/lib/rewrite-text-nodes.js +27 -40
- package/lib/routes-ui.js +0 -5
- package/lib/schemas.js +129 -262
- package/lib/sentry.js +21 -5
- package/lib/settings.js +58 -59
- package/lib/smtp-auth.js +6 -2
- package/lib/smtp-message-processor.js +28 -7
- package/lib/sso.js +7 -3
- package/lib/stream-encrypt.js +14 -13
- package/lib/swagger-options.js +3 -1
- package/lib/tls/provision.js +69 -3
- package/lib/tls/store.js +14 -1
- package/lib/tools.js +113 -52
- package/lib/totp.js +16 -1
- package/lib/ui-routes/account-routes.js +27 -63
- package/lib/ui-routes/admin-config-routes.js +111 -134
- package/lib/ui-routes/admin-entities-routes.js +101 -191
- package/lib/ui-routes/ai-options.js +104 -0
- package/lib/ui-routes/auth-routes.js +98 -18
- package/lib/ui-routes/export-routes.js +3 -23
- package/lib/ui-routes/internals-routes.js +12 -9
- package/lib/ui-routes/network-config-routes.js +8 -18
- package/lib/ui-routes/oauth-config-routes.js +80 -214
- package/lib/ui-routes/route-helpers.js +40 -44
- package/lib/ui-routes/unsubscribe-routes.js +2 -2
- package/lib/utils/decode-headers.js +32 -5
- package/lib/utils/header-map.js +62 -1
- package/lib/utils/network.js +2 -0
- package/lib/web-safe-html.js +77 -4
- package/lib/webhook-request.js +9 -1
- package/lib/webhook-routing.js +27 -1
- package/lib/webhooks.js +120 -43
- package/lib/worker-rpc-error.js +43 -2
- package/list-generate.js +13 -2
- package/package.json +38 -46
- package/sbom.json +1 -1
- package/scripts/refresh-test-tokens.js +42 -14
- package/server.js +340 -336
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +7 -8
- package/static/js/ee-client.js +145 -70
- package/static/js/ui.js +350 -154
- package/static/licenses.html +460 -1861
- package/translations/messages.pot +99 -99
- package/views/accounts/browse.hbs +10 -4
- package/views/config/ai.hbs +49 -41
- package/views/config/oauth/app.hbs +2 -1
- package/views/dashboard.hbs +18 -16
- package/views/layout/app.hbs +0 -22
- package/views/layout/login.hbs +2 -1
- package/views/partials/filter_editor_js.hbs +4 -3
- package/views/partials/side_menu.hbs +0 -4
- package/views/partials/ui/account-picker.hbs +6 -32
- package/views/partials/ui/model-picker.hbs +31 -0
- package/views/partials/ui/pagination.hbs +6 -1
- package/views/partials/ui/picker.hbs +47 -0
- package/views/unsubscribe.hbs +1 -1
- package/workers/api.js +33 -23
- package/workers/export.js +55 -60
- package/workers/imap.js +134 -47
- package/workers/submit.js +3 -1
- package/workers/webhooks.js +46 -27
- package/.githooks/pre-commit +0 -80
- package/.github/CODE_OF_CONDUCT.md +0 -76
- package/.github/contributing.md +0 -17
- package/.github/dependabot.yml +0 -22
- package/.github/docker-smoke-test.sh +0 -61
- package/.github/workflows/deploy.yml +0 -215
- package/.github/workflows/e2e.yml +0 -55
- package/.github/workflows/release.yaml +0 -217
- package/.github/workflows/test.yml +0 -307
- package/lib/api-routes/chat-routes.js +0 -535
- package/lib/append-list.js +0 -63
- package/lib/document-store.js +0 -75
- package/lib/es.js +0 -757
- package/lib/generate-text-preview.js +0 -61
- package/lib/imapproxy/imap-core/memory-notifier.js +0 -129
- package/lib/lua/h-push.lua +0 -32
- package/lib/pre-process.js +0 -196
- package/lib/threads.js +0 -155
- package/lib/ui-routes/document-store-routes.js +0 -806
- package/playwright.config.js +0 -47
- package/views/config/document-store/chat.hbs +0 -286
- package/views/config/document-store/index.hbs +0 -146
- package/views/config/document-store/mappings/index.hbs +0 -108
- package/views/config/document-store/mappings/new.hbs +0 -68
- package/views/config/document-store/pre-processing/index.hbs +0 -103
- package/views/partials/document_store_header.hbs +0 -30
- package/workers/documents.js +0 -1128
package/.github/dependabot.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
|
|
3
|
-
updates:
|
|
4
|
-
# The Node base image is the one dependency that goes stale without any diff to review, which is
|
|
5
|
-
# how it ended up 19 months behind. This entry exists to keep the digest current, nothing else.
|
|
6
|
-
- package-ecosystem: docker
|
|
7
|
-
directory: /
|
|
8
|
-
schedule:
|
|
9
|
-
interval: weekly
|
|
10
|
-
commit-message:
|
|
11
|
-
# `fix:` rather than `chore:`, so a base image bump reaches users through the release notes
|
|
12
|
-
# instead of being filtered out of them
|
|
13
|
-
prefix: fix
|
|
14
|
-
# Digest updates only. The Node major is a deliberate choice that has to stay in step with the
|
|
15
|
-
# CI matrix, the pkg targets and the deploy workflow, and it tracks Active LTS rather than
|
|
16
|
-
# Current - left unignored, the first run proposed 24-alpine to 26-alpine, which is exactly the
|
|
17
|
-
# drift this entry is meant to prevent. Moving the major is a manual decision.
|
|
18
|
-
ignore:
|
|
19
|
-
- dependency-name: node
|
|
20
|
-
update-types:
|
|
21
|
-
- version-update:semver-major
|
|
22
|
-
- version-update:semver-minor
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# Smoke test the EmailEngine CLI inside a built image.
|
|
4
|
-
#
|
|
5
|
-
# The Dockerfile copies an explicit allowlist of root-level files rather than `COPY . .`, so a CLI
|
|
6
|
-
# subcommand that dispatches to one (e.g. `scan` -> ../scan.js, `encrypt` -> ../encrypt.js) can be
|
|
7
|
-
# missing from the image while the build and the server both stay green - CMD only runs server.js.
|
|
8
|
-
# Both `scan` and `encrypt` shipped broken that way. Exercising the commands catches it regardless of
|
|
9
|
-
# how the module is referenced, which a source-level check cannot.
|
|
10
|
-
#
|
|
11
|
-
# Runs against a locally-loaded image (see the workflows) BEFORE the multi-arch push, so a broken
|
|
12
|
-
# image is never published - the previous version smoke tested the already-pushed image and could
|
|
13
|
-
# only detect the regression, not prevent shipping it.
|
|
14
|
-
#
|
|
15
|
-
# Usage: docker-smoke-test.sh <image-ref>
|
|
16
|
-
set -euo pipefail
|
|
17
|
-
|
|
18
|
-
image="${1:?usage: docker-smoke-test.sh <image-ref>}"
|
|
19
|
-
status=0
|
|
20
|
-
|
|
21
|
-
# Only the subcommands that dispatch to a root-level module can exercise the allowlist; everything
|
|
22
|
-
# else resolves out of lib/ or node_modules. This list is a runtime spot-check, not the completeness
|
|
23
|
-
# authority - test/dockerfile-cli-modules-test.js derives the full set of root-level requires from
|
|
24
|
-
# bin/emailengine.js and fails if any is not COPYed. Add new root-dispatching subcommands here too.
|
|
25
|
-
for cmd in scan encrypt; do
|
|
26
|
-
# These subcommands need Redis or arguments and are expected to exit non-zero; we only assert the
|
|
27
|
-
# module resolved. Capture the exit code explicitly (no `|| true`, which would mask a container
|
|
28
|
-
# that never started) so a docker/exec failure - exit >=125 - is treated as a failure, not a pass.
|
|
29
|
-
out=$(docker run --rm --entrypoint node "$image" bin/emailengine.js "$cmd" 2>&1) && rc=0 || rc=$?
|
|
30
|
-
|
|
31
|
-
if [ "$rc" -ge 125 ]; then
|
|
32
|
-
echo "::error::container failed to start for 'emailengine $cmd' (exit $rc)"
|
|
33
|
-
printf '%s\n' "$out"
|
|
34
|
-
status=1
|
|
35
|
-
continue
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
if grep -q "Cannot find module" <<<"$out"; then
|
|
39
|
-
echo "::error::emailengine $cmd cannot resolve its module inside the image"
|
|
40
|
-
printf '%s\n' "$out"
|
|
41
|
-
status=1
|
|
42
|
-
fi
|
|
43
|
-
done
|
|
44
|
-
|
|
45
|
-
# The image has to be able to say which commit it was built from. update-info.sh writes an empty
|
|
46
|
-
# commit rather than failing when EE_COMMIT_HASH is missing, and the Dockerfile requires the arg
|
|
47
|
-
# precisely so that cannot happen - but the Dockerfile's check is a source-level one, and this is the
|
|
48
|
-
# only place the built artifact is asked the question directly. Also catches the commit being right in
|
|
49
|
-
# the Dockerfile and wrong in the image, e.g. a stale layer replayed from the build cache.
|
|
50
|
-
commit=$(docker run --rm --entrypoint node "$image" -p "require('/emailengine/version-info.json').commit" 2>&1) && rc=0 || rc=$?
|
|
51
|
-
|
|
52
|
-
if [ "$rc" -ne 0 ]; then
|
|
53
|
-
echo "::error::could not read version-info.json from the image"
|
|
54
|
-
printf '%s\n' "$commit"
|
|
55
|
-
status=1
|
|
56
|
-
elif [ -z "${commit//[[:space:]]/}" ] || [ "$commit" = "undefined" ]; then
|
|
57
|
-
echo "::error::the image reports no commit hash - it was built without a usable EE_COMMIT_HASH build arg"
|
|
58
|
-
status=1
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
exit $status
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
on:
|
|
2
|
-
push:
|
|
3
|
-
branches:
|
|
4
|
-
- master
|
|
5
|
-
|
|
6
|
-
name: Deploy test instance and Docker image
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
|
|
11
|
-
concurrency:
|
|
12
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
|
13
|
-
cancel-in-progress: true
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
deploy:
|
|
17
|
-
name: Deploy Demo App
|
|
18
|
-
runs-on: ubuntu-24.04
|
|
19
|
-
timeout-minutes: 15
|
|
20
|
-
|
|
21
|
-
steps:
|
|
22
|
-
- name: Checkout
|
|
23
|
-
uses: actions/checkout@v6
|
|
24
|
-
|
|
25
|
-
- name: Use Node.js 24
|
|
26
|
-
uses: actions/setup-node@v6
|
|
27
|
-
with:
|
|
28
|
-
node-version: 24
|
|
29
|
-
|
|
30
|
-
- name: Install SSH key
|
|
31
|
-
uses: shimataro/ssh-key-action@v2
|
|
32
|
-
with:
|
|
33
|
-
key: ${{ secrets.SSH_KEY }}
|
|
34
|
-
known_hosts: ${{ secrets.KNOWN_HOSTS }}
|
|
35
|
-
|
|
36
|
-
- name: Deploy to server
|
|
37
|
-
env:
|
|
38
|
-
TARGET_HOST_02: dev.emailengine.app
|
|
39
|
-
NODE_ENV: production
|
|
40
|
-
SERVICE_NAME: emailengine
|
|
41
|
-
id: deploy
|
|
42
|
-
run: |
|
|
43
|
-
echo $GITHUB_SHA > commit.txt
|
|
44
|
-
EE_COMMIT_HASH=$GITHUB_SHA ./update-info.sh
|
|
45
|
-
npm install --omit=dev
|
|
46
|
-
tar czf /tmp/${SERVICE_NAME}.tar.gz --exclude .git .
|
|
47
|
-
scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" /tmp/${SERVICE_NAME}.tar.gz deploy@${TARGET_HOST_02}:
|
|
48
|
-
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" deploy@$TARGET_HOST_02 "/opt/deploy.sh ${SERVICE_NAME}"
|
|
49
|
-
|
|
50
|
-
- name: Deploy to demo server
|
|
51
|
-
env:
|
|
52
|
-
TARGET_HOST_02: dev.emailengine.app
|
|
53
|
-
NODE_ENV: production
|
|
54
|
-
SERVICE_NAME: emailengine-demo
|
|
55
|
-
id: deploy-demo
|
|
56
|
-
run: |
|
|
57
|
-
echo $GITHUB_SHA > commit.txt
|
|
58
|
-
EE_COMMIT_HASH=$GITHUB_SHA ./update-info.sh
|
|
59
|
-
npm install --omit=dev
|
|
60
|
-
tar czf /tmp/${SERVICE_NAME}.tar.gz --exclude .git .
|
|
61
|
-
scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" /tmp/${SERVICE_NAME}.tar.gz deploy@${TARGET_HOST_02}:
|
|
62
|
-
ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" deploy@$TARGET_HOST_02 "/opt/deploy.sh ${SERVICE_NAME}"
|
|
63
|
-
|
|
64
|
-
docker:
|
|
65
|
-
name: Build Docker Image (${{ matrix.arch }})
|
|
66
|
-
# One job per architecture, each on a runner of that architecture. The arm64 leg used to be
|
|
67
|
-
# emulated through QEMU on an x86 runner, where `npm ci` hit an illegal instruction and then
|
|
68
|
-
# hung until the job timeout - reliably on any commit that touches package-lock.json, since
|
|
69
|
-
# that busts the cached layer and forces the install to run in full. A native runner takes
|
|
70
|
-
# the emulator out of the picture, and each image now gets smoke tested on the architecture
|
|
71
|
-
# it was actually built for rather than only amd64.
|
|
72
|
-
runs-on: ${{ matrix.runner }}
|
|
73
|
-
timeout-minutes: 30
|
|
74
|
-
permissions:
|
|
75
|
-
contents: read
|
|
76
|
-
packages: write
|
|
77
|
-
strategy:
|
|
78
|
-
fail-fast: false
|
|
79
|
-
matrix:
|
|
80
|
-
include:
|
|
81
|
-
- arch: amd64
|
|
82
|
-
platform: linux/amd64
|
|
83
|
-
runner: ubuntu-24.04
|
|
84
|
-
- arch: arm64
|
|
85
|
-
platform: linux/arm64
|
|
86
|
-
runner: ubuntu-24.04-arm
|
|
87
|
-
|
|
88
|
-
steps:
|
|
89
|
-
- name: Checkout
|
|
90
|
-
uses: actions/checkout@v6
|
|
91
|
-
|
|
92
|
-
- name: Set up Docker Buildx
|
|
93
|
-
uses: docker/setup-buildx-action@v4
|
|
94
|
-
|
|
95
|
-
- name: Login to Docker Hub
|
|
96
|
-
uses: docker/login-action@v4
|
|
97
|
-
with:
|
|
98
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
99
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
100
|
-
|
|
101
|
-
- name: Login to GHCR
|
|
102
|
-
uses: docker/login-action@v4
|
|
103
|
-
with:
|
|
104
|
-
registry: ghcr.io
|
|
105
|
-
username: ${{ github.repository_owner }}
|
|
106
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
107
|
-
|
|
108
|
-
# Build locally and exercise the CLI BEFORE anything is published, so a broken image is
|
|
109
|
-
# never pushed. The push below replays from this build's local layer cache, so paying
|
|
110
|
-
# for the build twice costs almost nothing.
|
|
111
|
-
- name: Build for smoke test (local)
|
|
112
|
-
uses: docker/build-push-action@v7
|
|
113
|
-
with:
|
|
114
|
-
context: .
|
|
115
|
-
platforms: ${{ matrix.platform }}
|
|
116
|
-
load: true
|
|
117
|
-
tags: emailengine:smoke-test
|
|
118
|
-
build-args: |
|
|
119
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
120
|
-
# Without a cache backend BuildKit starts cold on every run: setup-buildx-action
|
|
121
|
-
# creates a fresh builder on an ephemeral runner. The scope is per-architecture so
|
|
122
|
-
# the two legs cannot evict each other's entries.
|
|
123
|
-
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
124
|
-
|
|
125
|
-
- name: Smoke test the CLI inside the image
|
|
126
|
-
run: bash .github/docker-smoke-test.sh emailengine:smoke-test
|
|
127
|
-
|
|
128
|
-
# Pushed by digest and left untagged: a tag can only be attached once both architectures
|
|
129
|
-
# exist, which is what the manifest job below does. Both registries are written here so
|
|
130
|
-
# the blobs are already in place and the manifest job never has to copy them between
|
|
131
|
-
# registries.
|
|
132
|
-
- name: Build and push by digest
|
|
133
|
-
id: build
|
|
134
|
-
uses: docker/build-push-action@v7
|
|
135
|
-
with:
|
|
136
|
-
context: .
|
|
137
|
-
platforms: ${{ matrix.platform }}
|
|
138
|
-
outputs: type=image,"name=docker.io/${{ github.repository }},ghcr.io/${{ github.repository }}",push-by-digest=true,name-canonical=true,push=true
|
|
139
|
-
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
140
|
-
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
|
|
141
|
-
build-args: |
|
|
142
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
143
|
-
|
|
144
|
-
- name: Export digest
|
|
145
|
-
run: |
|
|
146
|
-
mkdir -p /tmp/digests
|
|
147
|
-
digest="${{ steps.build.outputs.digest }}"
|
|
148
|
-
touch "/tmp/digests/${digest#sha256:}"
|
|
149
|
-
|
|
150
|
-
- name: Upload digest
|
|
151
|
-
uses: actions/upload-artifact@v4
|
|
152
|
-
with:
|
|
153
|
-
name: digests-${{ matrix.arch }}
|
|
154
|
-
path: /tmp/digests/*
|
|
155
|
-
if-no-files-found: error
|
|
156
|
-
# Long enough for "Re-run failed jobs" on a later working day to still find the
|
|
157
|
-
# digest of the leg that passed; the check below refuses to publish without it
|
|
158
|
-
retention-days: 7
|
|
159
|
-
|
|
160
|
-
docker-manifest:
|
|
161
|
-
name: Publish Docker Manifest
|
|
162
|
-
runs-on: ubuntu-24.04
|
|
163
|
-
needs: docker
|
|
164
|
-
timeout-minutes: 15
|
|
165
|
-
permissions:
|
|
166
|
-
contents: read
|
|
167
|
-
packages: write
|
|
168
|
-
|
|
169
|
-
steps:
|
|
170
|
-
- name: Download digests
|
|
171
|
-
uses: actions/download-artifact@v4
|
|
172
|
-
with:
|
|
173
|
-
path: /tmp/digests
|
|
174
|
-
pattern: digests-*
|
|
175
|
-
merge-multiple: true
|
|
176
|
-
|
|
177
|
-
# One digest file per platform in the build matrix. With fail-fast off, one leg can
|
|
178
|
-
# push its digest while the other fails, and a re-run that finds only the surviving
|
|
179
|
-
# artifact (or none, once they expire) would otherwise publish a single-platform
|
|
180
|
-
# manifest list under every tag as if it were complete.
|
|
181
|
-
- name: Check that every platform produced a digest
|
|
182
|
-
working-directory: /tmp/digests
|
|
183
|
-
run: |
|
|
184
|
-
count=$(ls -1 | wc -l)
|
|
185
|
-
if [ "$count" -ne 2 ]; then
|
|
186
|
-
echo "Expected 2 digests (linux/amd64, linux/arm64), found $count:"
|
|
187
|
-
ls -1
|
|
188
|
-
exit 1
|
|
189
|
-
fi
|
|
190
|
-
|
|
191
|
-
- name: Set up Docker Buildx
|
|
192
|
-
uses: docker/setup-buildx-action@v4
|
|
193
|
-
|
|
194
|
-
- name: Login to Docker Hub
|
|
195
|
-
uses: docker/login-action@v4
|
|
196
|
-
with:
|
|
197
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
198
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
199
|
-
|
|
200
|
-
- name: Login to GHCR
|
|
201
|
-
uses: docker/login-action@v4
|
|
202
|
-
with:
|
|
203
|
-
registry: ghcr.io
|
|
204
|
-
username: ${{ github.repository_owner }}
|
|
205
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
206
|
-
|
|
207
|
-
# :latest is owned by the release workflow (release.yaml) and always points at the
|
|
208
|
-
# newest release; per-push dev builds from master are published as :edge instead.
|
|
209
|
-
- name: Create and push the manifest list
|
|
210
|
-
working-directory: /tmp/digests
|
|
211
|
-
run: |
|
|
212
|
-
for image in "docker.io/${{ github.repository }}" "ghcr.io/${{ github.repository }}"; do
|
|
213
|
-
docker buildx imagetools create -t "${image}:edge" \
|
|
214
|
-
$(printf "${image}@sha256:%s " *)
|
|
215
|
-
done
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
name: E2E Tests
|
|
2
|
-
|
|
3
|
-
# Browser-driven happy-path end-to-end suite (test/e2e), kept separate from the unit and
|
|
4
|
-
# integration tiers so it is easy to re-run on its own and has its own requirements: it drives a
|
|
5
|
-
# real browser (Playwright/Chromium) and reaches external services (Ethereal for the test mailbox,
|
|
6
|
-
# postalsys.com for the 14-day trial).
|
|
7
|
-
|
|
8
|
-
on:
|
|
9
|
-
workflow_dispatch:
|
|
10
|
-
push:
|
|
11
|
-
branches: [master]
|
|
12
|
-
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
|
|
16
|
-
concurrency:
|
|
17
|
-
group: e2e-${{ github.ref }}
|
|
18
|
-
cancel-in-progress: true
|
|
19
|
-
|
|
20
|
-
jobs:
|
|
21
|
-
e2e:
|
|
22
|
-
name: E2E (Playwright)
|
|
23
|
-
timeout-minutes: 20
|
|
24
|
-
runs-on: ubuntu-24.04
|
|
25
|
-
services:
|
|
26
|
-
redis:
|
|
27
|
-
image: redis
|
|
28
|
-
options: >-
|
|
29
|
-
--health-cmd "redis-cli ping"
|
|
30
|
-
--health-interval 10s
|
|
31
|
-
--health-timeout 5s
|
|
32
|
-
--health-retries 5
|
|
33
|
-
ports:
|
|
34
|
-
- 6379:6379
|
|
35
|
-
steps:
|
|
36
|
-
- uses: actions/checkout@v6
|
|
37
|
-
- name: Use Node.js 24
|
|
38
|
-
uses: actions/setup-node@v6
|
|
39
|
-
with:
|
|
40
|
-
node-version: 24
|
|
41
|
-
cache: npm
|
|
42
|
-
- run: npm install
|
|
43
|
-
- name: Install Playwright browser
|
|
44
|
-
run: npx playwright install --with-deps chromium
|
|
45
|
-
- name: Run e2e tests
|
|
46
|
-
run: npm run test:e2e
|
|
47
|
-
env:
|
|
48
|
-
NODE_ENV: e2e
|
|
49
|
-
- name: Upload Playwright report
|
|
50
|
-
uses: actions/upload-artifact@v4
|
|
51
|
-
if: ${{ !cancelled() }}
|
|
52
|
-
with:
|
|
53
|
-
name: playwright-report
|
|
54
|
-
path: playwright-report/
|
|
55
|
-
retention-days: 7
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
on:
|
|
2
|
-
push:
|
|
3
|
-
branches:
|
|
4
|
-
- master
|
|
5
|
-
|
|
6
|
-
permissions:
|
|
7
|
-
contents: write
|
|
8
|
-
pull-requests: write
|
|
9
|
-
packages: write
|
|
10
|
-
attestations: write
|
|
11
|
-
id-token: write
|
|
12
|
-
|
|
13
|
-
name: Manage Release
|
|
14
|
-
jobs:
|
|
15
|
-
release_please:
|
|
16
|
-
name: Create or prepare release
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
outputs:
|
|
19
|
-
major: ${{ steps.release.outputs.major }}
|
|
20
|
-
minor: ${{ steps.release.outputs.minor }}
|
|
21
|
-
patch: ${{ steps.release.outputs.patch }}
|
|
22
|
-
release_created: ${{ steps.release.outputs.release_created }}
|
|
23
|
-
steps:
|
|
24
|
-
# Configured through release-please-config.json (manifest mode) rather than a
|
|
25
|
-
# `release-type` input here - the two are mutually exclusive, and only the config
|
|
26
|
-
# file can set `draft`, which the action exposes no input for. The release is drafted
|
|
27
|
-
# so users never see a version whose binaries do not exist yet, and `force-tag-creation`
|
|
28
|
-
# makes the tag anyway: GitHub withholds the tag for a draft, and upload.sh builds
|
|
29
|
-
# from the tag (falling back to HEAD behind an interactive prompt without it).
|
|
30
|
-
- uses: googleapis/release-please-action@v4
|
|
31
|
-
id: release
|
|
32
|
-
|
|
33
|
-
publish:
|
|
34
|
-
name: Publish NPM package
|
|
35
|
-
runs-on: ubuntu-latest
|
|
36
|
-
needs: release_please
|
|
37
|
-
# Fires as soon as release-please creates the release, which it does even though the
|
|
38
|
-
# release is a draft - `release_created` reports the release object, not its visibility.
|
|
39
|
-
#
|
|
40
|
-
# Deliberately NOT deferred until the draft is published. Doing that would mean waiting
|
|
41
|
-
# on a `release` event, and that event only exists because upload.sh publishes with a
|
|
42
|
-
# real user's credentials: draft releases raise no event, and one raised inside Actions
|
|
43
|
-
# by GITHUB_TOKEN never triggers a workflow. Several conditions all having to hold for a
|
|
44
|
-
# publish to happen makes the failure mode a silent non-publication, discovered late.
|
|
45
|
-
# Publishing here is one workflow run with nothing to choreograph.
|
|
46
|
-
#
|
|
47
|
-
# Publishing before the binaries exist is not shipping something broken: the npm package
|
|
48
|
-
# is the Node source and works on its own - it does not carry the pkg binaries, so it
|
|
49
|
-
# does not depend on the part of a release that can fail late.
|
|
50
|
-
#
|
|
51
|
-
# This job also has to stay in this file: npm trusted publishing (OIDC, which is why
|
|
52
|
-
# there is no token secret) is bound to the repository AND the workflow filename.
|
|
53
|
-
if: needs.release_please.outputs.release_created
|
|
54
|
-
permissions:
|
|
55
|
-
contents: read
|
|
56
|
-
id-token: write
|
|
57
|
-
steps:
|
|
58
|
-
- uses: actions/checkout@v6
|
|
59
|
-
- uses: actions/setup-node@v6
|
|
60
|
-
with:
|
|
61
|
-
node-version: 24
|
|
62
|
-
registry-url: "https://registry.npmjs.org"
|
|
63
|
-
- run: npm ci
|
|
64
|
-
- run: npm publish --provenance --access public
|
|
65
|
-
|
|
66
|
-
publish_docker:
|
|
67
|
-
name: Publish Tagged Docker Image (${{ matrix.arch }})
|
|
68
|
-
needs: release_please
|
|
69
|
-
if: needs.release_please.outputs.release_created
|
|
70
|
-
# One job per architecture, each on a runner of that architecture. The arm64 leg used to be
|
|
71
|
-
# emulated through QEMU on an x86 runner, where `npm ci` hit an illegal instruction and then
|
|
72
|
-
# hung until this timeout - and a release commit is the worst case for it, because the
|
|
73
|
-
# version bump busts the cached layer and forces the install to run in full. A native runner
|
|
74
|
-
# takes the emulator out of the picture.
|
|
75
|
-
runs-on: ${{ matrix.runner }}
|
|
76
|
-
timeout-minutes: 30
|
|
77
|
-
strategy:
|
|
78
|
-
fail-fast: false
|
|
79
|
-
matrix:
|
|
80
|
-
include:
|
|
81
|
-
- arch: amd64
|
|
82
|
-
platform: linux/amd64
|
|
83
|
-
runner: ubuntu-24.04
|
|
84
|
-
- arch: arm64
|
|
85
|
-
platform: linux/arm64
|
|
86
|
-
runner: ubuntu-24.04-arm
|
|
87
|
-
steps:
|
|
88
|
-
- run: echo version v${{needs.release_please.outputs.major}}.${{needs.release_please.outputs.minor}}.${{needs.release_please.outputs.patch}}
|
|
89
|
-
|
|
90
|
-
- uses: actions/checkout@v6
|
|
91
|
-
|
|
92
|
-
- name: Set up Docker Buildx
|
|
93
|
-
uses: docker/setup-buildx-action@v4
|
|
94
|
-
|
|
95
|
-
- name: Login to DockerHub
|
|
96
|
-
uses: docker/login-action@v4
|
|
97
|
-
with:
|
|
98
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
99
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
100
|
-
|
|
101
|
-
- name: Login to GHCR
|
|
102
|
-
uses: docker/login-action@v4
|
|
103
|
-
with:
|
|
104
|
-
registry: ghcr.io
|
|
105
|
-
username: ${{ github.repository_owner }}
|
|
106
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
107
|
-
|
|
108
|
-
# Build locally and exercise the CLI BEFORE anything is published, so a broken image is
|
|
109
|
-
# never pushed to the tags users pull. The push below replays from this build's local
|
|
110
|
-
# layer cache, so paying for the build twice costs almost nothing.
|
|
111
|
-
- name: Build for smoke test (local)
|
|
112
|
-
uses: docker/build-push-action@v7
|
|
113
|
-
with:
|
|
114
|
-
context: .
|
|
115
|
-
platforms: ${{ matrix.platform }}
|
|
116
|
-
load: true
|
|
117
|
-
tags: emailengine:smoke-test
|
|
118
|
-
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
119
|
-
build-args: |
|
|
120
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
121
|
-
|
|
122
|
-
- name: Smoke test the CLI inside the image
|
|
123
|
-
run: bash .github/docker-smoke-test.sh emailengine:smoke-test
|
|
124
|
-
|
|
125
|
-
# Pushed by digest and left untagged: the release tags can only be attached once both
|
|
126
|
-
# architectures exist, which is what the manifest job below does. Both registries are
|
|
127
|
-
# written here so the blobs are already in place and the manifest job never has to copy
|
|
128
|
-
# them between registries.
|
|
129
|
-
- name: Build and push by digest
|
|
130
|
-
id: build
|
|
131
|
-
uses: docker/build-push-action@v7
|
|
132
|
-
with:
|
|
133
|
-
context: .
|
|
134
|
-
platforms: ${{ matrix.platform }}
|
|
135
|
-
outputs: type=image,"name=docker.io/${{ github.repository }},ghcr.io/${{ github.repository }}",push-by-digest=true,name-canonical=true,push=true
|
|
136
|
-
cache-from: type=gha,scope=${{ matrix.arch }}
|
|
137
|
-
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
|
|
138
|
-
build-args: |
|
|
139
|
-
EE_COMMIT_HASH=${{ github.sha }}
|
|
140
|
-
|
|
141
|
-
- name: Export digest
|
|
142
|
-
run: |
|
|
143
|
-
mkdir -p /tmp/digests
|
|
144
|
-
digest="${{ steps.build.outputs.digest }}"
|
|
145
|
-
touch "/tmp/digests/${digest#sha256:}"
|
|
146
|
-
|
|
147
|
-
- name: Upload digest
|
|
148
|
-
uses: actions/upload-artifact@v4
|
|
149
|
-
with:
|
|
150
|
-
name: digests-${{ matrix.arch }}
|
|
151
|
-
path: /tmp/digests/*
|
|
152
|
-
if-no-files-found: error
|
|
153
|
-
# Long enough for "Re-run failed jobs" on a later working day to still find the
|
|
154
|
-
# digest of the leg that passed; the check below refuses to publish without it
|
|
155
|
-
retention-days: 7
|
|
156
|
-
|
|
157
|
-
publish_docker_manifest:
|
|
158
|
-
name: Publish Tagged Docker Manifest
|
|
159
|
-
runs-on: ubuntu-24.04
|
|
160
|
-
needs: [release_please, publish_docker]
|
|
161
|
-
# A dependent job is skipped when its needs are, so this is belt and braces - but it keeps
|
|
162
|
-
# the gate visible in the job itself rather than only in the job it depends on.
|
|
163
|
-
if: needs.release_please.outputs.release_created
|
|
164
|
-
timeout-minutes: 15
|
|
165
|
-
steps:
|
|
166
|
-
- name: Download digests
|
|
167
|
-
uses: actions/download-artifact@v4
|
|
168
|
-
with:
|
|
169
|
-
path: /tmp/digests
|
|
170
|
-
pattern: digests-*
|
|
171
|
-
merge-multiple: true
|
|
172
|
-
|
|
173
|
-
# One digest file per platform in the build matrix. With fail-fast off, one leg can
|
|
174
|
-
# push its digest while the other fails, and a re-run that finds only the surviving
|
|
175
|
-
# artifact (or none, once they expire) would otherwise publish a single-platform
|
|
176
|
-
# manifest list under every tag as if it were complete.
|
|
177
|
-
- name: Check that every platform produced a digest
|
|
178
|
-
working-directory: /tmp/digests
|
|
179
|
-
run: |
|
|
180
|
-
count=$(ls -1 | wc -l)
|
|
181
|
-
if [ "$count" -ne 2 ]; then
|
|
182
|
-
echo "Expected 2 digests (linux/amd64, linux/arm64), found $count:"
|
|
183
|
-
ls -1
|
|
184
|
-
exit 1
|
|
185
|
-
fi
|
|
186
|
-
|
|
187
|
-
- name: Set up Docker Buildx
|
|
188
|
-
uses: docker/setup-buildx-action@v4
|
|
189
|
-
|
|
190
|
-
- name: Login to DockerHub
|
|
191
|
-
uses: docker/login-action@v4
|
|
192
|
-
with:
|
|
193
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
194
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
195
|
-
|
|
196
|
-
- name: Login to GHCR
|
|
197
|
-
uses: docker/login-action@v4
|
|
198
|
-
with:
|
|
199
|
-
registry: ghcr.io
|
|
200
|
-
username: ${{ github.repository_owner }}
|
|
201
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
|
202
|
-
|
|
203
|
-
- name: Create and push the manifest list
|
|
204
|
-
working-directory: /tmp/digests
|
|
205
|
-
env:
|
|
206
|
-
MAJOR: ${{ needs.release_please.outputs.major }}
|
|
207
|
-
MINOR: ${{ needs.release_please.outputs.minor }}
|
|
208
|
-
PATCH: ${{ needs.release_please.outputs.patch }}
|
|
209
|
-
run: |
|
|
210
|
-
for image in "docker.io/${{ github.repository }}" "ghcr.io/${{ github.repository }}"; do
|
|
211
|
-
docker buildx imagetools create \
|
|
212
|
-
-t "${image}:latest" \
|
|
213
|
-
-t "${image}:v${MAJOR}.${MINOR}.${PATCH}" \
|
|
214
|
-
-t "${image}:v${MAJOR}.${MINOR}" \
|
|
215
|
-
-t "${image}:v${MAJOR}" \
|
|
216
|
-
$(printf "${image}@sha256:%s " *)
|
|
217
|
-
done
|