Skip to content

Commit

Permalink
chore: update project configurations and dependencies
Browse files Browse the repository at this point in the history
- Add `.cienv` file with QINIU_DIR and QINIU_DIST_DIR paths
- Update `.github/dependabot.yml` to include daily dependency updates for `/ui` and `/client` directories
- Update `.github/workflows/test.yml` to use Node.js version 16 instead of 18
- Update `Taskfile.yml` to include environment variables and commands for UI compilation and resource preparation
- Remove the `package_gui` task from `Taskfile.yml`
- Update `client/package.json` to include new platform-specific package scripts

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Mar 19, 2024
1 parent a85bf33 commit 8a07283
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .cienv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
QINIU_DIR=.release/qiniu
QINIU_DIST_DIR=.release/qiniu/dist
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,23 @@ updates:
rebase-strategy: auto
labels:
- bot/dependency

- package-ecosystem: npm
directory: /ui
schedule:
interval: daily
open-pull-requests-limit: 1
rebase-strategy: auto
labels:
- bot/dependency
- ui

- package-ecosystem: npm
directory: /client
schedule:
interval: daily
open-pull-requests-limit: 1
rebase-strategy: auto
labels:
- bot/dependency
- client
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
check-latest: true
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '16'
- name: install task
run: |
echo "install task"
Expand Down
69 changes: 63 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,73 @@

version: '3'

env:
GOPROXY: 'https://goproxy.cn,direct'
GOSUMDB: sum.golang.google.cn
GO_VERSION: $(go version)
BUILD_VERSION: $(cat VERSION || echo "0.0.1")
BUILD_TIME: $(date "+%Y%m%d%H%M")
GIT_COMMIT: $(git rev-parse --short HEAD || echo "abcdefgh")
ROOT_DIR: $(pwd)
BUILD_DIR: $(pwd)/_output
BIN_DIR: $(pwd)/bin
CLIENT_BIN_DIR: client/bin
CLIENT_OUT_DIR: client/out
LDFLAGS: "-w -s \
-X 'main.AppVersion={{.BUILD_VERSION}}' \
-X 'main.GoVersion={{.GO_VERSION}}' \
-X 'main.BuildTime={{.BUILD_TIME}}' \
-X 'main.BuildTime={{.BUILD_TIME}}' \
-X 'main.GitHash=${GIT_COMMIT}'"

tasks:

clean:
desc: clean
cmds:
- rm -rf res/res.go

install:
desc: install dep tools
run: once
cmds:
- go install github.com/kevinburke/go-bindata/v4/...@latest
status:
- command -v go-bindata

compile_ui:
desc: compile client ui
run: once
dir: ui
cmds:
- yarn install
- yarn build --dest ../client/ui

prepare:
desc: Prepare the environment
desc: start prepare res
run: once
deps:
- install
- compile_ui
cmds:
- echo "Preparing the environment"
- go-bindata -o=res/res.go -pkg=res res/...
status:
- test -f res/res.go

build_server:
desc: Build the server
run: once
cmds:
- echo "Building the server {{.GOOS}} {{.GOARCH}}"
- GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.GOOS}}/{{.GOARCH}}/zt-server{{if eq .GOOS "windows"}}.exe{{end}} cmd/server/main.go
status:
- test -f {{.BUILD_DIR}}/{{.GOOS}}/{{.GOARCH}}/zt-server{{if eq .GOOS "windows"}}.exe{{end}}

package_gui:
desc: Package the GUI
package_gui_client:
desc: start package gui
run: once
dir: client
cmds:
- echo "Packaging the GUI for {{.GOOS}} {{.GOARCH}}"
- npm run package-{{.GOOS}}-{{.GOARCH}}

build_cli:
desc: Build the CLI
Expand All @@ -31,3 +83,8 @@ tasks:
GOOS: darwin,
GOARCH: arm64
}
- task: package_gui_client
vars: {
GOOS: darwin,
GOARCH: arm64
}
9 changes: 5 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"scripts": {
"start": "NODE_ENV=development electron-forge start",
"package": "electron-forge package",
"package-mac": "npm run package -- --platform=darwin",
"package-linux": "npm run package -- --platform=linux",
"package-darwin-amd64": "npm run package -- --platform=darwin",
"package-darwin-arm64": "npm run package -- --platform=darwin --arch=arm64",
"package-linux-amd64": "npm run package -- --platform=linux",
"package-linux-arm64": "npm run package -- --platform=linux --arch=arm64",
"package-win64": "npm run package -- --platform=win32 --arch=x64",
"package-win32": "npm run package -- --platform=win32 --arch=ia32",
"package-windows-amd64": "npm run package -- --platform=win32 --arch=x64",
"package-windows-ia32": "npm run package -- --platform=win32 --arch=ia32",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
Expand Down

0 comments on commit 8a07283

Please sign in to comment.