fix: version getter

This commit is contained in:
boojack 2022-05-17 22:17:37 +08:00
parent 5731fb8912
commit 0b50122aac
6 changed files with 9 additions and 22 deletions

View File

@ -6,7 +6,7 @@ on:
- "main"
jobs:
docker:
build-and-push-dev-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

View File

@ -7,7 +7,7 @@ on:
- "release/v*.*.*"
jobs:
docker:
build-and-push-release-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

View File

@ -30,7 +30,7 @@
## ⚓️ Deploy with Docker
```docker
docker run --name memos --publish 8080:8080 --volume ~/.memos/:/var/opt/memos -e mode=prod neosmemo/memos:0.0.1
docker run --name memos --publish 5230:8080 --volume ~/.memos/:/var/opt/memos -e mode=prod neosmemo/memos:0.0.1
```
If the `~/.memos/` does not have a `memos_prod.db` file, then `memos` will auto generate it.
@ -45,7 +45,7 @@ Memos is built with a curated tech stack. It is optimized for developer experien
### Tech Stack
<img alt="tech stack" src="https://raw.githubusercontent.com/justmemos/memos/main/resources/tech-stack.png" width="320" />
<img alt="tech stack" src="https://raw.githubusercontent.com/justmemos/memos/main/resources/tech-stack.png" width="360" />
### Prerequisites

View File

@ -1 +0,0 @@
0.0.1

View File

@ -40,20 +40,6 @@ func checkDSN(dataDir string) (string, error) {
return dataDir, nil
}
func getSystemVersion() string {
absPath, err := filepath.Abs("./VERSION")
if err != nil {
return "0.0.0"
}
data, err := os.ReadFile(absPath)
if err != nil {
return "0.0.0"
}
return string(data)
}
// GetDevProfile will return a profile for dev.
func GetProfile() *Profile {
mode := os.Getenv("mode")
@ -79,12 +65,10 @@ func GetProfile() *Profile {
dsn := fmt.Sprintf("%s/memos_%s.db", dataDir, mode)
version := getSystemVersion()
return &Profile{
Mode: mode,
Port: port,
DSN: dsn,
Version: version,
Version: Version,
}
}

4
common/version.go Normal file
View File

@ -0,0 +1,4 @@
package common
// Version is the service current released version.
var Version = "0.0.1"