Skip to content

Commit 24be8e6

Browse files
author
hubert
committed
chore: workflow files changed
1 parent 196af8f commit 24be8e6

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

.github/workflows/deploy-bwg.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ jobs:
100100
key: ${{ runner.os }}-submodules-${{ hashFiles('.submodules/**/yarn.lock') }}
101101
- name: Build
102102
run: yarn build:clients && yarn build:servers
103-
- name: Show Dir
104-
run: ls
103+
- name: List dist dir
104+
run: ls dist
105105
- name: Build the Docker image
106106
run:
107107
| # 使用 上一步写的 Dockerfile 构建镜像并发布到私有仓库; 发布完成可以去 https://github.com/aceHubert?tab=packages 查看
@@ -121,8 +121,6 @@ jobs:
121121
username: ${{ secrets.SSH_USERNAME }} # 服务器用户名称;需要去仓库的 settings/secrets/actions 去创建
122122
key: ${{ secrets.SSH_KEY }} # 服务器密码;需要去仓库的 settings/secrets/actions 去创建
123123
port: ${{ secrets.SSH_PORT }} # 服务器端口,默认22;需要去仓库的 settings/secrets/actions 去创建
124-
debug: true
125-
command_timeout: 60m
126124
script: | # 发布镜像并删除之前的镜像
127125
whoami
128126
cd ${{ vars.PROJECT_DIR }}
@@ -133,4 +131,4 @@ jobs:
133131
docker logout https://${{ env.REGISTRY }}
134132
rm -f .env.${{ github.run_id }}
135133
docker cp pomelo-server:/app/nginx.conf ${{ vars.NGINX_CONF_DIR }}/pomelo.conf
136-
docker exec ${{ vars.NGINX_CONTAINER }} nginx -s reload
134+
docker exec ${{ vars.NGINX_CONTAINER_NAME }} nginx -s reload

.github/workflows/deploy-hw.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ jobs:
101101
key: ${{ runner.os }}-submodules-${{ hashFiles('.submodules/**/yarn.lock') }}
102102
- name: Build
103103
run: yarn build:clients && yarn build:servers
104-
- name: Show Dir
105-
run: ls
104+
- name: List dist dir
105+
run: ls dist
106106
- name: Build the Docker image
107107
run:
108108
| # 使用 上一步写的 Dockerfile 构建镜像并发布到私有仓库; 发布完成可以去 https://github.com/aceHubert?tab=packages 查看
@@ -115,6 +115,8 @@ jobs:
115115
environment:
116116
name: 'production'
117117
steps:
118+
- name: Checkout repository
119+
uses: actions/checkout@v3
118120
- name: Copy docker compose file to server
119121
uses: appleboy/[email protected]
120122
with:
@@ -126,38 +128,37 @@ jobs:
126128
target: ${{ vars.PROJECT_DIR }} # 服务器文件夹路径
127129
overwrite: true
128130
- name: Replace domain in nginx conf file
129-
uses: jacobtomlinson/gha-find-replace@v3
130-
with:
131-
include: "nginx.conf"
132-
find: "example.com"
133-
replace: "${{ vars.DOMAIN}}"
134-
regex: false
131+
uses: jacobtomlinson/gha-find-replace@v3
132+
with:
133+
include: "nginx.conf"
134+
find: "example.com"
135+
replace: "${{ vars.DOMAIN}}"
136+
regex: false
135137
- name: Copy nginx conf file to server
136-
uses: appleboy/[email protected]
137-
with:
138-
host: ${{ secrets.HW_SSH_HOST }} # 服务器ip地址 ; 需要去仓库的 settings/secrets/actions 去创建
139-
username: ${{ secrets.HW_SSH_USERNAME }} # 服务器用户名称;需要去仓库的 settings/secrets/actions 去创建
140-
key: ${{ secrets.HW_SSH_KEY }} # 服务器密码;需要去仓库的 settings/secrets/actions 去创建
141-
port: ${{ secrets.HW_SSH_PORT }} # 服务器端口,默认22;需要去仓库的 settings/secrets/actions 去创建
142-
source: "nginx.conf" # 本地文件路径
143-
target: ${{ vars.PROJECT_DIR }} # 服务器文件夹路径
144-
overwrite: true
138+
uses: appleboy/[email protected]
139+
with:
140+
host: ${{ secrets.HW_SSH_HOST }} # 服务器ip地址 ; 需要去仓库的 settings/secrets/actions 去创建
141+
username: ${{ secrets.HW_SSH_USERNAME }} # 服务器用户名称;需要去仓库的 settings/secrets/actions 去创建
142+
key: ${{ secrets.HW_SSH_KEY }} # 服务器密码;需要去仓库的 settings/secrets/actions 去创建
143+
port: ${{ secrets.HW_SSH_PORT }} # 服务器端口,默认22;需要去仓库的 settings/secrets/actions 去创建
144+
source: "nginx.conf" # 本地文件路径
145+
target: ${{ vars.PROJECT_DIR }} # 服务器文件夹路径
146+
overwrite: true
145147
- name: Deploy
146148
uses: appleboy/[email protected]
147149
with:
148150
host: ${{ secrets.HW_SSH_HOST }} # 服务器ip地址 ; 需要去仓库的 settings/secrets/actions 去创建
149151
username: ${{ secrets.HW_SSH_USERNAME }} # 服务器用户名称;需要去仓库的 settings/secrets/actions 去创建
150152
key: ${{ secrets.HW_SSH_KEY }} # 服务器密码;需要去仓库的 settings/secrets/actions 去创建
151153
port: ${{ secrets.HW_SSH_PORT }} # 服务器端口,默认22;需要去仓库的 settings/secrets/actions 去创建
152-
debug: true
153-
command_timeout: 60m
154154
script: | # 发布镜像并删除之前的镜像
155155
whoami
156156
cd ${{ vars.PROJECT_DIR }}
157+
echo "IMAGE_REPOSITORY=${{ env.REGISTRY_MIRROR }}/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}" > .env.${{ github.run_id }}
158+
echo -e "ORIGIN=https://${{vars.DOMAIN}}\nREDIS_URL=${{secrets.REDIS_URL}}\nINFRASTRUCTURE_DATABASE_CONNECTION=${{secrets.INFRASTRUCTURE_DATABASE_CONNECTION}}\nIDENTITY_DATABASE_CONNECTION=${{secrets.IDENTITY_DATABASE_CONNECTION}}" >> .env.${{ github.run_id }}
157159
mv docker-compose.deploy.yml docker-compose.yml
158-
echo "IMAGE_REPOSITORY=${{ env.REGISTRY_MIRROR }}/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}\nORIGIN=https://${{vars.DOMAIN}}\nREDIS_URL=${{secret.REDIS_URL}}\nINFRASTRUCTURE_DATABASE_CONNECTION=${{secrets.INFRASTRUCTURE_DATABASE_CONNECTION}}\nIDENTITY_DATABASE_CONNECTION=${{secrets.IDENTITY_DATABASE_CONNECTION}}" > .env.${{ github.run_id }}
159160
docker compose --env-file .env.${{ github.run_id }} up --force-recreate -d
160161
docker images -q ${{ env.REGISTRY_MIRROR }}/${{ env.IMAGE_REPOSITORY }} | grep -v $(docker images -q ${{ env.REGISTRY_MIRROR }}/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}) | xargs --no-run-if-empty docker rmi
161162
rm -f .env.${{ github.run_id }}
162-
mv nginx.conf ${{ vars.NGINX_CONF_DIR }}/pomelo.conf
163+
mv nginx.conf ${{ vars.HW_NGINX_CONF_DIR }}/pomelo.conf
163164
/etc/init.d/nginx reload

nest-cli.build.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"outDir": "dist/servers/conf"
5151
}
5252
],
53-
"watchAssets": true,
5453
"plugins": [
5554
{
5655
"name": "@nestjs/swagger",
@@ -127,7 +126,6 @@
127126
"outDir": "dist/servers/identity-server/"
128127
}
129128
],
130-
"watchAssets": true,
131129
"plugins": [
132130
{
133131
"name": "@nestjs/swagger",

0 commit comments

Comments
 (0)