diff --git a/.goreleaser.yaml b/.goreleaser.yaml index fbc45e7..d8f367a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -40,7 +40,7 @@ archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of uname. name_template: >- - {{ .ProjectName }}_ + cloudreve_ {{- .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 diff --git a/README.md b/README.md index 58e6b60..e8f5790 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ * :card_file_box: Drag & Drop to manage your files. * :family_woman_girl_boy: Multi-users with multi-groups. * :link: Create share links for files and folders with expiration date. -* :eye_speech_bubble: Preview videos, images, audios, texts, Office documents, ePub files online. +* :eye_speech_bubble: Preview videos, images, audios, ePub files online; edit texts, Office documents online. * :art: Customize theme colors, dark mode, PWA application, SPA, i18n. * :rocket: All-In-One packing, with all features out-of-the-box. * 🌈 ... ... @@ -74,50 +74,24 @@ The above is a minimum deploy example, you can refer to [Getting started](https: ## :gear: Build -You need to have `Go >= 1.18`, `node.js`, `yarn`, `zip` and other necessary dependencies before you can build it yourself. +You need to have `Go >= 1.18`, `node.js`, `yarn`, `zip`, [goreleaser](https://goreleaser.com/intro/) and other necessary dependencies before you can build it yourself. -#### Clone the code +#### Install goreleaser ```shell -git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git +go install github.com/goreleaser/goreleaser@latest ``` -#### Build static resources +#### Clone the code ```shell -# Enter frontend sub-module -cd assets -# Install dependencies -yarn install -# Start building -yarn run build -# Delete unused map files -cd build -find . -name "*.map" -type f -delete -# Return to main folder to pack static files -cd ../../ -zip -r - assets/build >assets.zip +git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git ``` #### Compile ```shell -# Obtain version number, commit SHA -export COMMIT_SHA=$(git rev-parse --short HEAD) -export VERSION=$(git describe --tags) - -# Compile -go build -a -o cloudreve -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'" -``` - -You can also start a quick build using `build.sh` in the project root directory: - -```shell -./build.sh [-a] [-c] [-b] [-r] - a - Build assets - c - Build binary backend - b - Build both assets and backend - r - Cross-compilation for final release +goreleaser build --clean --single-target --snapshot ``` ## :alembic: Stacks diff --git a/README_zh-CN.md b/README_zh-CN.md index a2056ab..2e91895 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -50,7 +50,7 @@ * :card_file_box: 文件拖拽管理 * :family_woman_girl_boy: 多用户、用户组、多存储策略 * :link: 创建文件、目录的分享链接,可设定自动过期 -* :eye_speech_bubble: 视频、图像、音频、文本、Office 文档、 ePub 在线预览 +* :eye_speech_bubble: 视频、图像、音频、 ePub 在线预览,文本、Office 文档在线编辑 * :art: 自定义配色、黑暗模式、PWA 应用、全站单页应用、国际化支持 * :rocket: All-In-One 打包,开箱即用 * 🌈 ... ... @@ -74,50 +74,24 @@ chmod +x ./cloudreve ## :gear: 构建 -自行构建前需要拥有 `Go >= 1.18`、`node.js`、`yarn`、`zip` 等必要依赖。 +自行构建前需要拥有 `Go >= 1.18`、`node.js`、`yarn`、`zip`, [goreleaser](https://goreleaser.com/intro/) 等必要依赖。 -#### 克隆代码 +#### 安装 goreleaser ```shell -git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git +go install github.com/goreleaser/goreleaser@latest ``` -#### 构建静态资源 +#### 克隆代码 ```shell -# 进入前端子模块 -cd assets -# 安装依赖 -yarn install -# 开始构建 -yarn run build -# 构建完成后删除映射文件 -cd build -find . -name "*.map" -type f -delete -# 返回项目主目录打包静态资源 -cd ../../ -zip -r - assets/build >assets.zip +git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git ``` #### 编译项目 ```shell -# 获得当前版本号、Commit -export COMMIT_SHA=$(git rev-parse --short HEAD) -export VERSION=$(git describe --tags) - -# 开始编译 -go build -a -o cloudreve -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'" -``` - -你也可以使用项目根目录下的 `build.sh` 快速开始构建: - -```shell -./build.sh [-a] [-c] [-b] [-r] - a - 构建静态资源 - c - 编译二进制文件 - b - 构建前端 + 编译二进制文件 - r - 交叉编译,构建用于release的版本 +goreleaser build --clean --single-target --snapshot ``` ## :alembic: 技术栈