From ed333d1501da65389c8c05cbe8f9f045a2700754 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 23 Dec 2021 19:36:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9E=84=E5=BB=BAtag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加自动构建tag --- .github/workflows/devops.yml | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/devops.yml diff --git a/.github/workflows/devops.yml b/.github/workflows/devops.yml new file mode 100644 index 00000000..ee5e1c93 --- /dev/null +++ b/.github/workflows/devops.yml @@ -0,0 +1,49 @@ +name: devops +on: + push: + tags: + - v* + 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 + shell: bash + run: | + git branch + ls -l + - 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 }} + MKDIR: ${{ secrets.MKDIR }} + 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}:${MKDIR}dist/ + scp -P ${PROT} -o StrictHostKeyChecking=no -r web/ser/* ${USER}@${HOST}:${MKDIR} + ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIR} && bash restart.sh > /dev/null 2>&1 &" From 3a5fdf771fdbd5f9e4eb62efd2f7cdbf629565e7 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Thu, 23 Dec 2021 19:39:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9docker=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=ADmysql=E8=BF=9E=E6=8E=A5=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改docker配置文件中mysql连接方式 --- server/config.docker.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/server/config.docker.yaml b/server/config.docker.yaml index 8466fc05..71bd4cbc 100644 --- a/server/config.docker.yaml +++ b/server/config.docker.yaml @@ -55,6 +55,7 @@ captcha: # mysql connect configuration mysql: path: '' + port: '' config: '' db-name: '' username: '' From 48b4bf843c97fe61663e2f8ae6f91ee166b4c6e4 Mon Sep 17 00:00:00 2001 From: tscuite <64051240+tscuite@users.noreply.github.com> Date: Fri, 24 Dec 2021 09:13:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=9D=99=E6=80=81=E8=B5=84=E6=BA=90=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2(resource)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加更新时静态资源目录替换(resource) --- .github/workflows/devops.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/devops.yml b/.github/workflows/devops.yml index ee5e1c93..912497e2 100644 --- a/.github/workflows/devops.yml +++ b/.github/workflows/devops.yml @@ -46,4 +46,6 @@ jobs: ssh-keyscan github.com >> ~/.ssh/known_hosts scp -P ${PROT} -o StrictHostKeyChecking=no -r web/dist/* ${USER}@${HOST}:${MKDIR}dist/ scp -P ${PROT} -o StrictHostKeyChecking=no -r web/ser/* ${USER}@${HOST}:${MKDIR} + ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIR}resource/ && rm -rf ${MKDIR}resource/*" + scp -P ${PROT} -o StrictHostKeyChecking=no -r server/resource/* ${USER}@${HOST}:${MKDIR}resource/ ssh -p ${PROT} -o StrictHostKeyChecking=no ${USER}@${HOST} "cd ${MKDIR} && bash restart.sh > /dev/null 2>&1 &"