Publish versioned shared Go module
Publish Go package / Publish shared Go module (push) Failing after 33s

This commit is contained in:
Gabriel20xx committed 2026-08-06 09:44:54 +02:00
1 parent 90080a8425
commit e2e21e84f7
8 files changed
+125 -16

No files matched your search

+21 -11
View File
@@ -6,7 +6,7 @@ The first packages are:
- `@gabriel20xx/design-tokens` — colors, typography, spacing, radii, shadows, and light/dark theme variables.
- `@gabriel20xx/web-ui` — Svelte components for the application shell, header/navigation, authentication, dialogs, profile/settings/about windows, buttons, cards, badges, and page headers.
- `repos.gfranz.ch/Gabriel20xx/SharedCode/backend` — Go helpers for environment configuration, `pgx` PostgreSQL pools, transactions, common auth persistence/passwords/tokens, and embedded Goose migrations.
- `repos.gfranz.ch/Gabriel20xx/shared/backend` — Go helpers for environment configuration, `pgx` PostgreSQL pools, transactions, common auth persistence/passwords/tokens, and embedded Goose migrations.
- `@gabriel20xx/node-backend` — Node.js `pg` pool/configuration, transactions, migrations, and auth/session persistence.
- `gabriel20xx-shared-backend` — Python `asyncpg` pool/configuration and auth/session persistence.
@@ -25,7 +25,7 @@ npm run test:node-backend
`npm run build` creates the distributable package in `packages/web-ui/dist`. The generated `dist` directory is intentionally ignored by the package configuration and should not be committed.
Validate the Go backend package from `SharedCode/backend`:
Validate the Go backend package from `shared/backend`:
```bash
cd backend
@@ -39,7 +39,7 @@ The repository is the canonical source and is installable directly from Gitea. T
builds the Svelte package during installation and exposes the runtime packages as subpaths:
```bash
npm install --save-exact git+https://repos.gfranz.ch/Gabriel20xx/SharedCode#<commit>
npm install --save-exact git+https://repos.gfranz.ch/Gabriel20xx/shared#<commit>
```
Use the shared UI from the root package:
@@ -96,10 +96,20 @@ The stylesheet imports the design tokens and uses an `sc-` prefix, so it does no
## Use the shared Go backend package
From a Go backend directory, add the module (the module is a subdirectory of the SharedCode repository):
The Go module is published to the private Gitea Go Package Registry. Configure a
read-only package token in the consuming workflow as `PACKAGE_REGISTRY_USERNAME`
and `PACKAGE_REGISTRY_TOKEN`, then configure Go to use the registry before running
`go get`, `go test`, or `go build`:
```bash
go get repos.gfranz.ch/Gabriel20xx/SharedCode/backend@backend/v0.1.0
export GOPROXY=https://repos.gfranz.ch/api/packages/Gabriel20xx/go,https://proxy.golang.org
export GONOSUMDB=repos.gfranz.ch/Gabriel20xx/shared/*
```
From a Go backend directory, add the released module (the module is a subdirectory of the shared repository):
```bash
go get repos.gfranz.ch/Gabriel20xx/shared/backend@v0.1.0
```
Then initialize the pool and shared auth store at startup:
@@ -109,8 +119,8 @@ import (
"context"
"log"
"repos.gfranz.ch/Gabriel20xx/SharedCode/backend/auth"
"repos.gfranz.ch/Gabriel20xx/SharedCode/backend/postgres"
"repos.gfranz.ch/Gabriel20xx/shared/backend/auth"
"repos.gfranz.ch/Gabriel20xx/shared/backend/postgres"
)
cfg, err := postgres.FromEnv()
@@ -133,7 +143,7 @@ Use `auth.SchemaOptions{SingleUser: false, APITokens: true}` for a multi-user se
For embedded SQL migrations, use `migrate.Up(ctx, databaseURL, embeddedMigrations, "migrations")`. The package does not contain application tables, so migrations remain versioned with the service that owns those tables.
The Go module lives under `backend`, so its release tag must use the submodule prefix (`backend/v0.1.0`). If the SharedCode code is moved into its own repository, update the module path and use ordinary `v0.1.0` tags instead.
The Go module lives under `backend`, so its release tag must use the submodule prefix (`backend/v0.1.0`). The consuming `go.mod` uses the normal module version (`v0.1.0`). To publish a release, push a tag such as `backend/v0.1.0`; the Gitea workflow packages the module and uploads it to the private registry. Never reuse an existing package version.
For Node services, install the shared package after publishing it:
@@ -237,14 +247,14 @@ The shared reset controls request a short-lived code printed by the server-side
Before publishing, build the packages and install them from the local workspace in a frontend project:
```bash
# From Web/SharedCode
# From Web/shared
npm run build
# From a project frontend directory; do not commit this file dependency for CI
npm install ../../../SharedCode/packages/design-tokens ../../../SharedCode/packages/web-ui
npm install ../../../shared/packages/design-tokens ../../../shared/packages/web-ui
```
For CI and normal development, use the published version instead of a `file:` dependency. A local file dependency only works when the checkout also contains the sibling `SharedCode` directory.
For CI and normal development, use the published version instead of a `file:` dependency. A local file dependency only works when the checkout also contains the sibling `shared` directory.
## Updating the design system