staging #17
|
|
@ -80,18 +80,19 @@ jobs:
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/webhook@master
|
uses: actions/webhook@master
|
||||||
with:
|
with:
|
||||||
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=fd8e4bfb-a906-4601-9894-e166b3ecedda
|
urls: https://oapi.dingtalk.com/robot/send?access_token=6ddafcada8f44f4bad4a7314c4d9bd19a895ded0a1ba1afdaff5dd01a5af6781
|
||||||
content_type: application/json
|
content_type: application/json
|
||||||
template: |
|
template: |
|
||||||
{
|
{
|
||||||
"msgtype": "markdown",
|
"msgtype": "markdown",
|
||||||
"markdown": {
|
"markdown": {
|
||||||
"content": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**
|
"title":"项目部署通知",
|
||||||
|
"text": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**\n
|
||||||
>**构建结果**: ${{ job.status }}
|
>**构建结果**: ${{ job.status }}
|
||||||
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
||||||
>**代码分支**: ${{ gitea.ref_name }}
|
>**代码分支**: ${{ gitea.ref_name }}
|
||||||
>**提交标识**: ${{ gitea.sha }}
|
>**提交标识**: ${{ gitea.sha }}
|
||||||
>**提交发起**: ${{ gitea.actor}}
|
>**提交发起**: ${{ gitea.actor }}
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
name: 部署生产环境
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: ${{ gitea.repository_owner }}/cut.service
|
||||||
|
PROJECT_NAME: Dolphin.ExamPictureCut.HttpApi.Host
|
||||||
|
PUBLISH_PATH: marking.cut.service
|
||||||
|
ASPNETCORE_ENVIRONMENT: Production
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: 发布版本
|
||||||
|
runs-on: linux
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.publish_version.outputs.version }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 下载源码
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: 发布版本
|
||||||
|
id: publish_version
|
||||||
|
uses: actions/auto-release@master
|
||||||
|
|
||||||
|
job1:
|
||||||
|
name: 编译发布
|
||||||
|
runs-on: linux
|
||||||
|
needs: release
|
||||||
|
container:
|
||||||
|
image: node:16-bullseye
|
||||||
|
volumes:
|
||||||
|
- /opt/.runner/nuget_packages:/root/.nuget/packages
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 下载源码
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: 使用缓存
|
||||||
|
uses: actions/cache@master
|
||||||
|
with:
|
||||||
|
mount: |
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
- name: 编译后端
|
||||||
|
uses: actions/aspnet@8.0
|
||||||
|
with:
|
||||||
|
project_name: ${{ env.PROJECT_NAME }}
|
||||||
|
os: win
|
||||||
|
|
||||||
|
- name: 打包压缩
|
||||||
|
run: |
|
||||||
|
tar -zcvf marking.cut.service.tar.gz publish
|
||||||
|
|
||||||
|
- name: 发送到web站点
|
||||||
|
uses: docker://appleboy/drone-scp
|
||||||
|
with:
|
||||||
|
# 需要部署的主机地址
|
||||||
|
host: 10.255.255.3
|
||||||
|
# 主机ssh端口
|
||||||
|
port: 22
|
||||||
|
username: ${{ secrets.PUBLISH_USER_NAME }}
|
||||||
|
password: ${{ secrets.PUBLISH_PASSWORD }}
|
||||||
|
command_timeout: 2m
|
||||||
|
overwrite: true
|
||||||
|
target: /etc/nginx/wwwroot/static/marking
|
||||||
|
source: marking.cut.service.tar.gz
|
||||||
|
|
||||||
|
- name: 启动生产环境105
|
||||||
|
uses: docker://appleboy/drone-ssh
|
||||||
|
with:
|
||||||
|
host: minio.23544.com
|
||||||
|
port: 22105
|
||||||
|
username: marking
|
||||||
|
password: ${{ secrets.PUBLISH_WIN_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
|
||||||
|
mkdir /d/marking.cut.service
|
||||||
|
cd /d/marking.cut.service
|
||||||
|
curl "http://localhost:5244/publish/kill?processName=Dolphin.ExamPictureCut.HttpApi.Host"
|
||||||
|
rm -rf marking.cut.service.tar.gz
|
||||||
|
curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz
|
||||||
|
tar -zxvf marking.cut.service.tar.gz
|
||||||
|
curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2"
|
||||||
|
|
||||||
|
- name: 启动生产环境106
|
||||||
|
uses: docker://appleboy/drone-ssh
|
||||||
|
with:
|
||||||
|
host: minio.23544.com
|
||||||
|
port: 22106
|
||||||
|
username: marking
|
||||||
|
password: ${{ secrets.PUBLISH_WIN_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
|
||||||
|
mkdir /d/marking.cut.service
|
||||||
|
cd /d/marking.cut.service
|
||||||
|
curl "http://localhost:5244/publish/kill?processName=Dolphin.ExamPictureCut.HttpApi.Host"
|
||||||
|
rm -rf marking.cut.service.tar.gz
|
||||||
|
curl -O https://static.w.23544.com:8843/marking/marking.cut.service.tar.gz
|
||||||
|
tar -zxvf marking.cut.service.tar.gz
|
||||||
|
curl "http://localhost:5244/publish/run?execPath=D:/marking.cut.service/publish/Dolphin.ExamPictureCut.HttpApi.Host.exe&count=2"
|
||||||
|
|
||||||
|
- name: 发送构建通知
|
||||||
|
if: ${{ always() }}
|
||||||
|
uses: actions/webhook@master
|
||||||
|
with:
|
||||||
|
urls: https://oapi.dingtalk.com/robot/send?access_token=6ddafcada8f44f4bad4a7314c4d9bd19a895ded0a1ba1afdaff5dd01a5af6781
|
||||||
|
content_type: application/json
|
||||||
|
template: |
|
||||||
|
{
|
||||||
|
"msgtype": "markdown",
|
||||||
|
"markdown": {
|
||||||
|
"title":"项目部署通知",
|
||||||
|
"text": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**\n
|
||||||
|
>**构建结果**: ${{ job.status }}
|
||||||
|
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
||||||
|
>**代码分支**: ${{ gitea.ref_name }}
|
||||||
|
>**提交标识**: ${{ gitea.sha }}
|
||||||
|
>**提交发起**: ${{ gitea.actor }}
|
||||||
|
"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -80,18 +80,19 @@ jobs:
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/webhook@master
|
uses: actions/webhook@master
|
||||||
with:
|
with:
|
||||||
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=fd8e4bfb-a906-4601-9894-e166b3ecedda
|
urls: https://oapi.dingtalk.com/robot/send?access_token=6ddafcada8f44f4bad4a7314c4d9bd19a895ded0a1ba1afdaff5dd01a5af6781
|
||||||
content_type: application/json
|
content_type: application/json
|
||||||
template: |
|
template: |
|
||||||
{
|
{
|
||||||
"msgtype": "markdown",
|
"msgtype": "markdown",
|
||||||
"markdown": {
|
"markdown": {
|
||||||
"content": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**
|
"title":"项目部署通知",
|
||||||
|
"text": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**\n
|
||||||
>**构建结果**: ${{ job.status }}
|
>**构建结果**: ${{ job.status }}
|
||||||
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
||||||
>**代码分支**: ${{ gitea.ref_name }}
|
>**代码分支**: ${{ gitea.ref_name }}
|
||||||
>**提交标识**: ${{ gitea.sha }}
|
>**提交标识**: ${{ gitea.sha }}
|
||||||
>**提交发起**: ${{ gitea.actor}}
|
>**提交发起**: ${{ gitea.actor }}
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,17 @@ jobs:
|
||||||
uses: actions/aspnet@8.0
|
uses: actions/aspnet@8.0
|
||||||
with:
|
with:
|
||||||
project_name: ${{ env.PROJECT_NAME }}
|
project_name: ${{ env.PROJECT_NAME }}
|
||||||
|
os: win
|
||||||
|
|
||||||
- name: 打包上传镜像
|
# - name: 打包上传镜像
|
||||||
uses: actions/docker@master
|
# uses: actions/docker@master
|
||||||
with:
|
# with:
|
||||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
# registry: ${{ secrets.DOCKER_REGISTRY }}
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
# username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
# password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
image: ${{ env.IMAGE_NAME }}
|
# image: ${{ env.IMAGE_NAME }}
|
||||||
context: publish
|
# context: publish
|
||||||
tags: latest,${{ gitea.ref_name }}
|
# tags: latest,${{ gitea.ref_name }}
|
||||||
|
|
||||||
- name: 打包压缩
|
- name: 打包压缩
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -65,7 +66,7 @@ jobs:
|
||||||
host: minio.23544.com
|
host: minio.23544.com
|
||||||
port: 22105
|
port: 22105
|
||||||
username: marking
|
username: marking
|
||||||
password: ${{ secrets.PWD_105 }}
|
password: ${{ secrets.PUBLISH_WIN_PASSWORD }}
|
||||||
script: |
|
script: |
|
||||||
|
|
||||||
mkdir /d/marking.cut.service
|
mkdir /d/marking.cut.service
|
||||||
|
|
@ -82,7 +83,7 @@ jobs:
|
||||||
host: minio.23544.com
|
host: minio.23544.com
|
||||||
port: 22106
|
port: 22106
|
||||||
username: marking
|
username: marking
|
||||||
password: ${{ secrets.PWD_106 }}
|
password: ${{ secrets.PUBLISH_WIN_PASSWORD }}
|
||||||
script: |
|
script: |
|
||||||
|
|
||||||
mkdir /d/marking.cut.service
|
mkdir /d/marking.cut.service
|
||||||
|
|
@ -97,18 +98,19 @@ jobs:
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/webhook@master
|
uses: actions/webhook@master
|
||||||
with:
|
with:
|
||||||
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=fd8e4bfb-a906-4601-9894-e166b3ecedda
|
urls: https://oapi.dingtalk.com/robot/send?access_token=6ddafcada8f44f4bad4a7314c4d9bd19a895ded0a1ba1afdaff5dd01a5af6781
|
||||||
content_type: application/json
|
content_type: application/json
|
||||||
template: |
|
template: |
|
||||||
{
|
{
|
||||||
"msgtype": "markdown",
|
"msgtype": "markdown",
|
||||||
"markdown": {
|
"markdown": {
|
||||||
"content": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**
|
"title":"项目部署通知",
|
||||||
|
"text": "${{ job.status == 'success' && '✅' || '❌' }}**${{ gitea.repository }}**\n
|
||||||
>**构建结果**: ${{ job.status }}
|
>**构建结果**: ${{ job.status }}
|
||||||
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
>**构建详情**: [点击查看](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }})
|
||||||
>**代码分支**: ${{ gitea.ref_name }}
|
>**代码分支**: ${{ gitea.ref_name }}
|
||||||
>**提交标识**: ${{ gitea.sha }}
|
>**提交标识**: ${{ gitea.sha }}
|
||||||
>**提交发起**: ${{ gitea.actor}}
|
>**提交发起**: ${{ gitea.actor }}
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||||
|
|
||||||
ARG ASPNETCORE_ENVIRONMENT
|
|
||||||
ENV ASPNETCORE_ENVIRONMENT ${ASPNETCORE_ENVIRONMENT}
|
|
||||||
|
|
||||||
ENV TZ=Asia/Shanghai \
|
ENV TZ=Asia/Shanghai \
|
||||||
DEBIAN_FRONTEND=noninteractive
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue