From de81f8dc7ad113354b6331b4932cfea0bd514975 Mon Sep 17 00:00:00 2001 From: amass <168062547@qq.com> Date: Sun, 30 Jun 2024 18:34:47 +0800 Subject: [PATCH] add notify. --- .drone.yml | 50 ------------------------------------ .gitea/workflows/deploy.yaml | 31 ++++++++++++++++++++++ resource/notify.tpl | 6 ----- 3 files changed, 31 insertions(+), 56 deletions(-) delete mode 100644 .drone.yml create mode 100755 .gitea/workflows/deploy.yaml delete mode 100644 resource/notify.tpl diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index f8ca4b2..0000000 --- a/.drone.yml +++ /dev/null @@ -1,50 +0,0 @@ -kind: pipeline -type: docker -name: default - -steps: - - name: build - image: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop:22.04 - commands: - - echo begin build ... - - resource/build.sh drone_build - - echo -e "Running InterviewQuestions" - - build/InterviewQuestions/InterviewQuestions - - echo -e "Running AmassToolsetTest" - - build/Test/AmassToolsetTest --run_test=HttpServerTest - - name: deploy - image: appleboy/drone-scp - settings: - host: - - amass.fun - username: root - password: - from_secret: ssh_password - port: 22 - command_timeout: 2m - overwrite: true - target: /root/HttpServer - source: build/HttpServer/HttpServer - - name: restart - image: appleboy/drone-ssh - settings: - host: - - amass.fun - username: root - password: - from_secret: ssh_password - port: 22 - command_timeout: 2m - script: - - pkill HttpServer - - cd /root/HttpServer - - source /etc/profile;nohup ./HttpServer >logs/HttpServer.log 2>&1 &" - - name: notify - image: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop:22.04 - when: - status: - - failure - - success - commands: - - >- - cat resource/notify.tpl | envsubst | jq -sR . | xargs -0 -I {} curl -H "Content-Type: application/json" -X POST -d '{"type":"text","msg":{} }' https://amass.fun/notify diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100755 index 0000000..111dbb7 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,31 @@ +name: Deploy +run-name: build and deploy app to server. +on: [push] +jobs: + Build: + runs-on: [ubuntu-latest, ubuntu-24.04] + container: + image: frp-by1.wwvvww.cn:45288/ubuntu_dev:22.04 + steps: + - name: Notify-Start + if: ${{ always() }} + run: | + echo "${{ github.repository }} 开始构建..." > notify.tpl + echo "构建地址: https://gitea.amass.fun/${{ github.repository }}/actions/runs/${{ github.run_number }}">> notify.tpl + echo "仓库地址: https://gitea.amass.fun/${{ github.repository }}">> notify.tpl + echo "提交ID: $(git rev-parse --short HEAD)">> notify.tpl + echo -n "提交消息: ${{ github.event.head_commit.message }}">> notify.tpl + cat notify.tpl | envsubst | jq -sR . | xargs -0 -I {} curl -H "Content-Type: application/json" -X POST -d '{"type":"text","msg":{} }' https://amass.fun/notify + - name: Check out source. + uses: actions/checkout@v4 + - run: resource/build.sh build + - name: Notify-End + if: ${{ always() }} + run: | + echo "${{ github.repository }} 构建结束" > notify.tpl + echo "构建状态: ${{ job.status }}">> notify.tpl + echo "构建地址: https://gitea.amass.fun/${{ github.repository }}/actions/runs/${{ github.run_number }}">> notify.tpl + echo "仓库地址: https://gitea.amass.fun/${{ github.repository }}">> notify.tpl + echo "提交ID: $(git rev-parse --short HEAD)">> notify.tpl + echo -n "提交消息: ${{ github.event.head_commit.message }}">> notify.tpl + cat notify.tpl | envsubst | jq -sR . | xargs -0 -I {} curl -H "Content-Type: application/json" -X POST -d '{"type":"text","msg":{} }' https://amass.fun/notify diff --git a/resource/notify.tpl b/resource/notify.tpl deleted file mode 100644 index 6151fc1..0000000 --- a/resource/notify.tpl +++ /dev/null @@ -1,6 +0,0 @@ -repo: $DRONE_REPO_NAME -status: $DRONE_BUILD_STATUS -commit: $DRONE_COMMIT -message: $DRONE_COMMIT_MESSAGE -build link: $DRONE_BUILD_LINK -repo link: $DRONE_REPO_LINK \ No newline at end of file