Skip to content

Commit

Permalink
CD - DEBUG
Browse files Browse the repository at this point in the history
trheyi committed Jan 23, 2022
1 parent b9bff24 commit 30a3428
Showing 3 changed files with 125 additions and 15 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.17]
steps:
- name: Setup Cache
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout Kun
uses: actions/checkout@v2
with:
repository: yaoapp/kun
path: kun

- name: Checkout Xun
uses: actions/checkout@v2
with:
repository: yaoapp/xun
path: xun

- name: Checkout Gou
uses: actions/checkout@v2
with:
repository: yaoapp/gou
path: gou
token: ${{ secrets.TOKEN }}

- name: Checkout UI
uses: actions/checkout@v2
with:
repository: yaoapp/xiang-ui
path: ui
token: ${{ secrets.TOKEN }}

- name: Move Kun, Xun, Gou, UI
run: |
mv kun ../
mv xun ../
mv gou ../
mv ui ../
ls -l .
ls -l ../
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Setup Go Tools
run: |
if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi
if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
- name: Make Artifact
run: |
ls -l .
ls -l ../
60 changes: 46 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ plugin-mac:
# 编译静态文件
.PHONY: static
static:
git clone https://github.com/YaoApp/xiang-saas-ui-kxy .tmp/ui
git clone git@github.com:YaoApp/xiang-saas-ui-kxy .tmp/ui
cd .tmp/ui && yarn install && yarn build
rm -rf ui
mv .tmp/ui/dist ui
@@ -143,13 +143,13 @@ xiang: bindata
.PHONY: release
release: clean
mkdir -p dist/release
git clone https://github.com/YaoApp/xiang dist/release
git clone https://github.com/YaoApp/kun dist/kun
git clone https://github.com/YaoApp/xun dist/xun
git clone https://github.com/YaoApp/gou dist/gou
git clone git@github.com:YaoApp/xiang.git dist/release
git clone git@github.com:YaoApp/kun.git dist/kun
git clone git@github.com:YaoApp/xun.git dist/xun
git clone git@github.com:YaoApp/gou.git dist/gou

# UI制品
git clone https://github.com/YaoApp/xiang-ui .tmp/ui
git clone git@github.com:YaoApp/xiang-ui .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
rm -rf dist/release/ui
@@ -169,11 +169,11 @@ release: clean
sed "s/*.iqka.com/$(XIANG_DOMAIN)/g" dist/release/share/const.go.bak > dist/release/share/const.go; \
fi;

cd dist/release && CGO_ENABLED=1 CC=x86_64-linux-musl-gcc CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -o ../../.tmp/xiang-${VERSION}-linux-amd64
# cd dist/release && CGO_ENABLED=1 CC=x86_64-linux-musl-gcc CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -o ../../.tmp/xiang-${VERSION}-linux-amd64
# cd dist/release && GOOS=linux GOARCH=arm GOARM=7 go build -v -o ../../.tmp/xiang-${VERSION}-linux-arm
# cd dist/release && GOOS=linux GOARCH=arm64 GOARM=7 go build -v -o ../../.tmp/xiang-${VERSION}-linux-arm64
cd dist/release && GOOS=darwin GOARCH=amd64 go build -v -o ../../.tmp/xiang-${VERSION}-darwin-amd64
cd dist/release && GOOS=windows GOARCH=386 go build -v -o ../../.tmp/xiang-${VERSION}-windows-386
cd dist/release && CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -o ../../.tmp/xiang-${VERSION}-darwin-amd64
# cd dist/release && GOOS=windows GOARCH=386 go build -v -o ../../.tmp/xiang-${VERSION}-windows-386

rm -rf dist/release
mkdir -p dist/release
@@ -187,13 +187,13 @@ hi:
.PHONY: arm
arm: clean
mkdir -p dist/release
git clone https://github.com/YaoApp/xiang dist/release
git clone https://github.com/YaoApp/kun dist/kun
git clone https://github.com/YaoApp/xun dist/xun
git clone https://github.com/YaoApp/gou dist/gou
git clone git@github.com:YaoApp/xiang.git dist/release
git clone git@github.com:YaoApp/kun.git dist/kun
git clone git@github.com:YaoApp/xun.git dist/xun
git clone git@github.com:YaoApp/gou.git dist/gou

# UI制品
git clone https://github.com/YaoApp/xiang-ui .tmp/ui
git clone git@github.com:YaoApp/xiang-ui.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
rm -rf dist/release/ui
@@ -216,6 +216,38 @@ arm: clean
mv .tmp/xiang-*-* dist/release/
chmod +x dist/release/xiang-*-*

.PHONY: linux
linux: clean
mkdir -p dist/release
git clone git@github.com:YaoApp/xiang.git dist/release
git clone git@github.com:YaoApp/kun.git dist/kun
git clone git@github.com:YaoApp/xun.git dist/xun
git clone git@github.com:YaoApp/gou.git dist/gou

# UI制品
git clone git@github.com:YaoApp/xiang-ui.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
rm -rf dist/release/ui
mv .tmp/ui/dist dist/release/ui

# 静态文件打包
mkdir -p .tmp/data
cp -r dist/release/ui .tmp/data/
cp -r dist/release/xiang .tmp/data/
go-bindata -fs -pkg data -o dist/release/data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui

# 制品
mkdir -p dist
cd dist/release && CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -o ../../.tmp/xiang-${VERSION}-linux-amd64

rm -rf dist/release
mkdir -p dist/release
mv .tmp/xiang-*-* dist/release/
chmod +x dist/release/xiang-*-*

.PHONY: win32
win32: bindata
GOOS=windows GOARCH=386 go build -v -o .tmp/xiang-windows-386
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ ssh max@demo-crm.iqka.com mkdir -p /data/demo-crm/ui/releases/$VERSION/
ssh max@demo-crm.iqka.com "echo {\\\"version\\\":\\\"$VERSION\\\"} > /data/demo-crm/ui/releases/latest.json"
scp ~/Code/bin/xiang-$VERSION-linux-amd64 max@demo-crm.iqka.com:/data/demo-crm/ui/releases/$VERSION/yao-$VERSION-linux-amd64
scp ~/Code/bin/xiang-$VERSION-darwin-amd64 max@demo-crm.iqka.com:/data/demo-crm/ui/releases/$VERSION/yao-$VERSION-darwin-amd64
scp ~/Code/bin/xiang-$VERSION-windows-386 max@demo-crm.iqka.com:/data/demo-crm/ui/releases/$VERSION/yao-$VERSION-windows-386
# scp ~/Code/bin/xiang-$VERSION-windows-386 max@demo-crm.iqka.com:/data/demo-crm/ui/releases/$VERSION/yao-$VERSION-windows-386

repace "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g"
scp ~/Code/yao/xiang/shell/install.sh.new max@demo-crm.iqka.com:/data/demo-crm/ui/releases/$VERSION/install.sh

0 comments on commit 30a3428

Please sign in to comment.