From f98f10f869cdbd7db755ca4455945bd5d63c2d16 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 30 Dec 2021 10:59:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提交到这个分支会自动发布测试环境 --- .github/workflows/devops-test.yaml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/devops-test.yaml diff --git a/.github/workflows/devops-test.yaml b/.github/workflows/devops-test.yaml new file mode 100644 index 00000000..a813732f --- /dev/null +++ b/.github/workflows/devops-test.yaml @@ -0,0 +1,54 @@ +name: devops-test +on: + push: + branches: [test] + workflow_dispatch: +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['16.x'] + go-version: ['1.16'] + steps: + - name: Check out branch + uses: actions/checkout@v2 + - name: Sed Config + env: + PROD: ${{ secrets.PROD }} + TESTING: ${{ secrets.TESTING }} + shell: bash + run: | + git branch + ls -l + sed -i 's/${PROD}/${TESTING}/g' web/.env.production + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2.1.2 + with: + node-version: ${{ matrix.node-version }} + - name: Build-Node + run: | + cd web/ && yarn install && yarn run build + - name: Use Go ${{ matrix.go-version }} + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + - name: Build-go + run: | + cd server/ && go mod tidy && go build && mkdir ../web/ser && mv server ../web/ser/ && cd ../web/ser/ && ls -s + - name: restart + env: + KEY: ${{ secrets.KEY }} + HOST: ${{ secrets.HOST }} + USER: ${{ secrets.USER }} + PROT: ${{ secrets.PROT }} + MKDIRTEST: ${{ secrets.MKDIRTEST }} + run: | + mkdir -p ~/.ssh/ && echo "$KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + ssh-keyscan github.com >> ~/.ssh/known_hosts + scp -P ${PROT} -o StrictHostKeyChecking=no -r web/dist/* ${USER}@${HOST}:${MKDIRTEST}dist/ + scp -P ${PROT} -o StrictHostKeyChecking=no -r web/ser/* ${USER}@${HOST}:${MKDIRTEST} + ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIRTEST}resource/ && rm -rf ${MKDIRTEST}resource/*" + scp -P ${PROT} -o StrictHostKeyChecking=no -r server/resource/* ${USER}@${HOST}:${MKDIRTEST}resource/ + ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIRTEST} && bash restart.sh > /dev/null 2>&1 &" From 121aceaa7a46d4c38c360e24f589450f1e628dfb Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 30 Dec 2021 11:00:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改后端地址 --- web/.env.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/.env.production b/web/.env.production index 79ba49a3..2e3d72d8 100644 --- a/web/.env.production +++ b/web/.env.production @@ -4,4 +4,4 @@ VITE_CLI_PORT = 8080 VITE_SERVER_PORT = 8888 VITE_BASE_API = /api #下方修改为你的线上ip -VITE_BASE_PATH = http://8.141.61.63 \ No newline at end of file +VITE_BASE_PATH = https://demo.gin-vue-admin.com From 0de17d568339320dae0a891f3524a5b4d0933592 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 30 Dec 2021 13:03:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E4=B8=BA=E5=8F=8C=E5=BC=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 单引号中参数获取失败 --- .github/workflows/devops-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/devops-test.yaml b/.github/workflows/devops-test.yaml index a813732f..8667075b 100644 --- a/.github/workflows/devops-test.yaml +++ b/.github/workflows/devops-test.yaml @@ -22,7 +22,7 @@ jobs: run: | git branch ls -l - sed -i 's/${PROD}/${TESTING}/g' web/.env.production + sed -i "s/${PROD}/${TESTING}/g" web/.env.production - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2.1.2 with: From c896b42ab62fde80791976e9feb62378079acae7 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 30 Dec 2021 13:19:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=89=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=A1=A8=E5=8D=95=E7=94=9F=E6=88=90=E5=99=A8=E7=9A=84?= =?UTF-8?q?url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 构建前修改表单生成器的url --- .github/workflows/devops-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/devops-test.yaml b/.github/workflows/devops-test.yaml index 8667075b..bbdf270d 100644 --- a/.github/workflows/devops-test.yaml +++ b/.github/workflows/devops-test.yaml @@ -23,6 +23,7 @@ jobs: git branch ls -l sed -i "s/${PROD}/${TESTING}/g" web/.env.production + sed -i 's/${basePath}:${basePort}/${basePath}/g' web/src/view/systemTools/formCreate/index.vue - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2.1.2 with: