Skip to content

Commit

Permalink
[add] XGen v1.0 packing
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Sep 27, 2022
1 parent 622842d commit a57b312
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 143 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- name: Install coscmd
run: sudo pip3 install coscmd

- name: Install pnpm
run: npm install -g pnpm

- name: Setup Cache
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -63,19 +66,26 @@ jobs:
ref: 5e91d3d9dcabd2986f901b6b31590e49fc3c4dd8
path: v8go

- name: Checkout UI
- name: Checkout XGen v0.9
uses: actions/checkout@v2
with:
repository: yaoapp/xgen
path: ui
path: xgen-v0.9

- name: Checkout XGen v1.0
uses: actions/checkout@v2
with:
repository: yaoapp/xgen-next
path: xgen-v1.0

- name: Move Kun, Xun, Gou, UI, V8Go
run: |
mv kun ../
mv xun ../
mv gou ../
mv v8go ../
mv ui ../
mv xgen-v0.9 ../
mv xgen-v1.0 ../
ls -l .
ls -l ../
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/release-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- name: Install coscmd
run: sudo pip3 install coscmd

- name: Install pnpm
run: npm install -g pnpm

- name: Setup Cache
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -55,19 +58,26 @@ jobs:
ref: 5e91d3d9dcabd2986f901b6b31590e49fc3c4dd8
path: v8go

- name: Checkout UI
- name: Checkout XGen v0.9
uses: actions/checkout@v2
with:
repository: yaoapp/xgen
path: ui
path: xgen-v0.9

- name: Checkout XGen v1.0
uses: actions/checkout@v2
with:
repository: yaoapp/xgen-next
path: xgen-v1.0

- name: Move Kun, Xun, Gou, UI, V8Go
run: |
mv kun ../
mv xun ../
mv gou ../
mv v8go ../
mv ui ../
mv xgen-v0.9 ../
mv xgen-v1.0 ../
ls -l .
ls -l ../
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ logs
logs/application.log
yao-arm64
tests/db/yao.db
env.*.sh
env.*.sh
xgen/v0.9/*
xgen/v1.0/*
!xgen/v0.9/index.html
!xgen/v1.0/index.html
86 changes: 62 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pack: bindata fmt
bindata:
mkdir -p .tmp/data
cp -r ui .tmp/data/
cp -r xgen .tmp/data/
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
Expand All @@ -149,17 +150,24 @@ bindata:
artifacts-linux: clean
mkdir -p dist/release

# Building UI
# Building XGEN v0.9
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" ../ui/public/icon/md_icon.css
cd ../ui && npm install && npm run build
cd ../xgen-v0.9 && npm install && npm run build

# Building XGEN v1.0
export XGEN_BASE=yao
export BASE=yao
export NODE_ENV=production
cd ../xgen-v1.0 && pnpm install && pnpm run build

# Packing
mkdir -p .tmp/data
cp -r ../ui/dist .tmp/data/ui
mkdir -p .tmp/data/xgen
cp -r ./ui .tmp/data/ui
cp -r ../xgen-v0.9/dist .tmp/data/xgen/v0.9
cp -r ../xgen-v1.0/packages/app/dist .tmp/data/xgen/v1.0
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui

# Replace PRVERSION
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}\"/g" share/const.go
Expand All @@ -184,17 +192,25 @@ artifacts-linux: clean
artifacts-macos: clean
mkdir -p dist/release

# Building UI

# Building XGEN v0.9
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" ../ui/public/icon/md_icon.css
cd ../ui && npm install && npm run build
cd ../xgen-v0.9 && npm install && npm run build

# Building XGEN v1.0
export XGEN_BASE=yao
export BASE=yao
export NODE_ENV=production
cd ../xgen-v1.0 && pnpm install && pnpm run build

# Packing
mkdir -p .tmp/data
cp -r ../ui/dist .tmp/data/ui
mkdir -p .tmp/data/xgen
cp -r ./ui .tmp/data/ui
cp -r ../xgen-v0.9/dist .tmp/data/xgen/v0.9
cp -r ../xgen-v1.0/packages/app/dist .tmp/data/xgen/v1.0
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui

# Replace PRVERSION
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}\"/g" share/const.go
Expand Down Expand Up @@ -243,18 +259,29 @@ release: clean
mkdir -p dist/release
mkdir .tmp

# Building UI
git clone https://github.com/YaoApp/xgen.git .tmp/ui
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/ui/public/icon/md_icon.css
cd .tmp/ui && cnpm install && npm run build
# Building XGEN v0.9
# git clone https://github.com/YaoApp/xgen.git .tmp/xgen/v0.9
# sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/xgen/v0.9/public/icon/md_icon.css
# cd .tmp/xgen/v0.9 && npm install && npm run build
mkdir -p .tmp/xgen/v0.9
cp -r xgen/v0.9 .tmp/xgen/v0.9/dist

# Building XGEN v1.0
export XGEN_BASE=yao
export BASE=yao
export NODE_ENV=production
git clone https://github.com/YaoApp/xgen-next.git .tmp/xgen/v1.0
cd .tmp/xgen/v1.0 && pnpm install && pnpm run build

# Packing
mkdir -p .tmp/data
cp -r .tmp/ui/dist .tmp/data/ui
mkdir -p .tmp/data/xgen
cp -r ./ui .tmp/data/ui
cp -r .tmp/xgen/v0.9/dist .tmp/data/xgen/v0.9
cp -r .tmp/xgen/v1.0/packages/app/dist .tmp/data/xgen/v1.0
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui
rm -rf .tmp/xgen

# Replace PRVERSION
sed -ie "s/const PRVERSION = \"DEV\"/const PRVERSION = \"${COMMIT}\"/g" share/const.go
Expand All @@ -273,18 +300,29 @@ linux-release: clean
mkdir -p dist/release
mkdir .tmp

# Building UI
git clone https://github.com/YaoApp/xgen.git .tmp/ui
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/ui/public/icon/md_icon.css
cd .tmp/ui && yarn install && yarn build
# Building XGEN v0.9
git clone https://github.com/YaoApp/xgen.git .tmp/xgen/v0.9
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/xgen/v0.9/public/icon/md_icon.css
cd .tmp/xgen/v0.9 && yarn install && yarn build
mkdir -p .tmp/xgen/v0.9
cp -r xgen/v0.9 .tmp/xgen/v0.9/dist

# Building XGEN v1.0
export XGEN_BASE=yao
export BASE=yao
export NODE_ENV=production
git clone https://github.com/YaoApp/xgen-next.git .tmp/xgen/v1.0
cd .tmp/xgen/v1.0 && pnpm install && pnpm run build

# Packing
mkdir -p .tmp/data
cp -r .tmp/ui/dist .tmp/data/ui
mkdir -p .tmp/data/xgen
cp -r ./ui .tmp/data/ui
cp -r .tmp/xgen/v0.9/dist .tmp/data/xgen/v0.9
cp -r .tmp/xgen/v1.0/packages/app/dist .tmp/data/xgen/v1.0
cp -r yao .tmp/data/
go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui
rm -rf .tmp/xgen

# Making artifacts
mkdir -p dist
Expand Down
17 changes: 13 additions & 4 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,19 @@ var startCmd = &cobra.Command{
fmt.Println(color.WhiteString(L("Root")), color.GreenString(" %s", root))
}

fmt.Println(color.WhiteString(L("Frontend")), color.GreenString(" http://%s%s/", host, port))
fmt.Println(color.WhiteString(L("Dashboard")), color.GreenString(" http://%s%s/xiang/login/admin", host, port))
fmt.Println(color.WhiteString(L("API")), color.GreenString(" http://%s%s/api", host, port))
fmt.Println(color.WhiteString(L("Listening")), color.GreenString(" %s:%d", config.Conf.Host, config.Conf.Port))
if share.App.XGen == "1.0" {
fmt.Println(color.WhiteString(L(" XGen")), color.GreenString(" 1.0"))
fmt.Println(color.WhiteString(L("Frontend")), color.GreenString(" http://%s%s/", host, port))
fmt.Println(color.WhiteString(L("Dashboard")), color.GreenString(" http://%s%s/yao/login/admin", host, port))
fmt.Println(color.WhiteString(L("API")), color.GreenString(" http://%s%s/api", host, port))
fmt.Println(color.WhiteString(L("Listening")), color.GreenString(" %s:%d", config.Conf.Host, config.Conf.Port))

} else {
fmt.Println(color.WhiteString(L("Frontend")), color.GreenString(" http://%s%s/", host, port))
fmt.Println(color.WhiteString(L("Dashboard")), color.GreenString(" http://%s%s/xiang/login/admin", host, port))
fmt.Println(color.WhiteString(L("API")), color.GreenString(" http://%s%s/api", host, port))
fmt.Println(color.WhiteString(L("Listening")), color.GreenString(" %s:%d", config.Conf.Host, config.Conf.Port))
}

// development mode
if mode == "development" {
Expand Down
Loading

0 comments on commit a57b312

Please sign in to comment.