add notify.
Some checks failed
Deploy / Build (push) Failing after 0s

This commit is contained in:
amass 2024-06-30 18:34:47 +08:00
parent 2e3248562e
commit de81f8dc7a
3 changed files with 31 additions and 56 deletions

View File

@ -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

31
.gitea/workflows/deploy.yaml Executable file
View File

@ -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

View File

@ -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