diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e21e5e9..04a22e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,6 +52,8 @@ jobs: jq ".version = \"$VERSION\"" web/package.json > tmp.$$.json && mv tmp.$$.json web/package.json shell: bash + # TODO: only update if there are any changes + - name: Commit updated web/package.json run: | git config --global user.name "GitHub Actions" diff --git a/services/backend/Dockerfile b/services/backend/Dockerfile index 94c0763..c81de4a 100644 --- a/services/backend/Dockerfile +++ b/services/backend/Dockerfile @@ -19,6 +19,12 @@ RUN go mod download COPY . . +# Generate TypeScript files from Go structs +RUN go install github.com/gzuidhof/tygo@latest && \ + tygo generate && \ + mkdir -p /app/web/types && \ + mv generated/types/index.ts /app/web/types/index.ts + RUN go build -o main ./cmd/api EXPOSE 8080 diff --git a/services/backend/generated/types/.gitkeep b/services/backend/generated/types/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/services/backend/tygo.yaml b/services/backend/tygo.yaml new file mode 100644 index 0000000..2075c4e --- /dev/null +++ b/services/backend/tygo.yaml @@ -0,0 +1,9 @@ +packages: + - path: "video-archiver/models" + output_path: "./generated/types" + type_mappings: + time.Time: "string /* RFC3339 */" + null.String: "null | string" + null.Bool: "null | boolean" + uuid.UUID: "string /* uuid */" + uuid.NullUUID: "null | string /* uuid */" \ No newline at end of file