Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix(release): inject build version into artifacts
boojackf8a304bae330
diff --git a/.github/workflows/build-canary-image.yml b/.github/workflows/build-canary-image.ymlindex 15212eca0..8be60768e 100644--- a/.github/workflows/build-canary-image.yml+++ b/.github/workflows/build-canary-image.yml@@ -95,6 +95,9 @@ jobs:context: .file: ./scripts/Dockerfileplatforms: ${{ matrix.platform }}+ build-args: |+ VERSION=canary+ COMMIT=${{ github.sha }}cache-from: type=gha,scope=build-${{ matrix.platform }}cache-to: type=gha,mode=max,scope=build-${{ matrix.platform }}outputs: type=image,name=neosmemo/memos,push-by-digest=true,name-canonical=true,push=truediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 88c718f27..34fa76b8a 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -161,7 +161,7 @@ jobs:go build \-trimpath \- -ldflags="-s -w -X github.com/usememos/memos/internal/version.Version=${{ needs.prepare.outputs.version }} -extldflags '-static'" \+ -ldflags="-s -w -X github.com/usememos/memos/internal/version.Version=${{ needs.prepare.outputs.version }} -X github.com/usememos/memos/internal/version.Commit=${{ github.sha }} -extldflags '-static'" \-tags netgo,osusergo \-o "build/${output_name}" \./cmd/memosdiff --git a/.release-please-manifest.json b/.release-please-manifest.jsonindex 1f59b6814..2b114496d 100644--- a/.release-please-manifest.json+++ b/.release-please-manifest.json@@ -1,3 +1,3 @@{- ".": "0.27.1"+ ".": "0.27.0"}diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b954b7d8d..8dc5da08d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,12 +1,5 @@# Changelog-## [0.27.1](https://github.com/usememos/memos/compare/v0.27.0...v0.27.1) (2026-04-19)---### Bug Fixes--* mixed-case user resource names ([#5853](https://github.com/usememos/memos/issues/5853)) ([01be01f](https://github.com/usememos/memos/commit/01be01f4b7676af41bdd1758b1e9b096aa922546))-## [0.27.0](https://github.com/usememos/memos/compare/v0.26.2...v0.27.0) (2026-04-18)diff --git a/internal/version/version.go b/internal/version/version.goindex 685f0c979..519014d1b 100644--- a/internal/version/version.go+++ b/internal/version/version.go@@ -7,9 +7,11 @@ import ("golang.org/x/mod/semver")-// Version is the service current released version.-// Semantic versioning: https://semver.org/-var Version = "0.27.0"+// Version is set by release builds and defaults to a development build marker.+var Version = "dev"++// Commit is set by CI builds and defaults to an unknown revision marker.+var Commit = "unknown"func GetCurrentVersion() string {return Versiondiff --git a/scripts/Dockerfile b/scripts/Dockerfileindex 642851516..75a3dc3ed 100644--- a/scripts/Dockerfile+++ b/scripts/Dockerfile@@ -14,13 +14,13 @@ COPY . .# Please build frontend first, so that the static files are available.# Refer to `pnpm release` in package.json for the build command.-ARG TARGETOS TARGETARCH VERSION COMMIT+ARG TARGETOS TARGETARCH VERSION=dev COMMIT=unknownRUN --mount=type=cache,target=/go/pkg/mod \--mount=type=cache,target=/root/.cache/go-build \CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \go build \-trimpath \- -ldflags="-s -w -extldflags '-static'" \+ -ldflags="-s -w -X github.com/usememos/memos/internal/version.Version=${VERSION} -X github.com/usememos/memos/internal/version.Commit=${COMMIT} -extldflags '-static'" \-tags netgo,osusergo \-o memos \./cmd/memosdiff --git a/store/migrator.go b/store/migrator.goindex dc2e56a1a..7dbe66352 100644--- a/store/migrator.go+++ b/store/migrator.go@@ -295,19 +295,27 @@ func (s *Store) seed(ctx context.Context) error {return tx.Commit()}+// GetCurrentSchemaVersion returns the latest schema version available for the configured database driver.func (s *Store) GetCurrentSchemaVersion() (string, error) {- currentVersion := version.GetCurrentVersion()- minorVersion := version.GetMinorVersion(currentVersion)- filePaths, err := fs.Glob(migrationFS, fmt.Sprintf("%s%s/*.sql", s.getMigrationBasePath(), minorVersion))+ filePaths, err := fs.Glob(migrationFS, fmt.Sprintf("%s*/*.sql", s.getMigrationBasePath()))if err != nil {return "", errors.Wrap(err, "failed to read migration files")}-- slices.Sort(filePaths)if len(filePaths) == 0 {- return fmt.Sprintf("%s.0", minorVersion), nil+ return defaultSchemaVersion, nil+ }++ currentSchemaVersion := defaultSchemaVersion+ for _, filePath := range filePaths {+ fileSchemaVersion, err := s.getSchemaVersionOfMigrateScript(filePath)+ if err != nil {+ return "", errors.Wrap(err, "failed to get schema version of migrate script")+ }+ if version.IsVersionGreaterThan(fileSchemaVersion, currentSchemaVersion) {+ currentSchemaVersion = fileSchemaVersion+ }}- return s.getSchemaVersionOfMigrateScript(filePaths[len(filePaths)-1])+ return currentSchemaVersion, nil}// getSchemaVersionOfMigrateScript extracts the schema version from the migration script file path.