feat: implement versioning and release management in the project
- Added automatic versioning based on git tags using semantic-release in Gitea Actions. - Introduced new API endpoints `GET /version` and `GET /v1/version` to expose build metadata. - Updated Docker build process to include version and build time information in Go binaries. - Enhanced documentation with details on release processes and versioning guidelines. - Integrated version display in the web application for better user visibility.
This commit is contained in:
@@ -10,22 +10,38 @@ RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
||||
|
||||
FROM deps AS build-all
|
||||
COPY . .
|
||||
ARG VERSION=dev
|
||||
ARG GIT_SHA=unknown
|
||||
ARG BUILD_TIME=
|
||||
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
|
||||
set -eux; \
|
||||
mkdir -p /out; \
|
||||
for d in cmd/*/; do \
|
||||
name="$(basename "$d")"; \
|
||||
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o "/out/${name}" "./cmd/${name}"; \
|
||||
CGO_ENABLED=0 go build -trimpath \
|
||||
-ldflags="-s -w \
|
||||
-X evobgp/internal/version.Version=${VERSION} \
|
||||
-X evobgp/internal/version.GitSHA=${GIT_SHA} \
|
||||
-X evobgp/internal/version.BuildTime=${BUILD_TIME}" \
|
||||
-o "/out/${name}" "./cmd/${name}"; \
|
||||
done
|
||||
|
||||
# Один бинарь (локальная сборка); в CI — build-all + runtime.
|
||||
FROM deps AS build
|
||||
COPY . .
|
||||
ARG BIN=evobgp-api
|
||||
ARG VERSION=dev
|
||||
ARG GIT_SHA=unknown
|
||||
ARG BUILD_TIME=
|
||||
RUN --mount=type=cache,target=/go/pkg/mod,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cache/go-build,sharing=locked \
|
||||
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/evobgp "./cmd/${BIN}"
|
||||
CGO_ENABLED=0 go build -trimpath \
|
||||
-ldflags="-s -w \
|
||||
-X evobgp/internal/version.Version=${VERSION} \
|
||||
-X evobgp/internal/version.GitSHA=${GIT_SHA} \
|
||||
-X evobgp/internal/version.BuildTime=${BUILD_TIME}" \
|
||||
-o /out/evobgp "./cmd/${BIN}"
|
||||
|
||||
FROM public.ecr.aws/docker/library/debian:bookworm-slim AS birdc
|
||||
ARG BIRD_VERSION=2.14
|
||||
|
||||
Reference in New Issue
Block a user