From 5db5607faa481f74b31a666da24dbff84575af9a Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 26 Jul 2024 23:36:33 +0800 Subject: [PATCH] chore: --- .github/workflows/build-image.yml | 20 ++++++++++++++++ .github/workflows/trigger-demo.yml | 38 ++++++++++++++++++++++++++++++ deploy.trigger | 1 + package.json | 2 +- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/trigger-demo.yml create mode 100644 deploy.trigger diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index c5f59089..ebca4bc3 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -67,3 +67,23 @@ jobs: tags: | registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}} + + - name: trigger deploy demo + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + const fs = require('fs'); + const http = require('axios'); + const webhook = "http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG: + await http({ + url: webhook, + method: 'POST', + headers: { + "Content-Type": "application/json" + }, + data: { + 'CERTD_VERSION': '${{steps.get_certd_version.outputs.result}}' + } + }) + console.log(`webhook success:${webhook}`) diff --git a/.github/workflows/trigger-demo.yml b/.github/workflows/trigger-demo.yml new file mode 100644 index 00000000..b53968ce --- /dev/null +++ b/.github/workflows/trigger-demo.yml @@ -0,0 +1,38 @@ +name: build-image +on: + push: + branches: ['v2'] + paths: + - "deploy.trigger" + +# schedule: +# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间 +# - cron: '17 19 * * *' +permissions: + contents: read + +jobs: + deploy-certd-demo: + runs-on: ubuntu-latest + steps: + - run: | + npm install -g axios + - name: trigger deploy demo + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + const fs = require('fs'); + const http = require('axios'); + const webhook = "http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG: + await http({ + url: webhook, + method: 'POST', + headers: { + "Content-Type": "application/json" + }, + data: { + 'CERTD_VERSION': '${{steps.get_certd_version.outputs.result}}' + } + }) + console.log(`webhook success:${webhook}`) diff --git a/deploy.trigger b/deploy.trigger new file mode 100644 index 00000000..1afa6c39 --- /dev/null +++ b/deploy.trigger @@ -0,0 +1 @@ +23:16 diff --git a/package.json b/package.json index b2852e89..e64a5766 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start": "lerna bootstrap --hoist", "i-all": "lerna link && lerna exec npm install ", "publish": "npm run prepublishOnly1 && lerna publish --conventional-commits --create-release github && npm run afterpublishOnly", - "afterpublishOnly": "time /t >build.trigger && git add ./build.md && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push", + "afterpublishOnly": "time /t >build.trigger && git add ./build.trigger && git commit -m \"build: trigger build image\" && TIMEOUT /T 10 && git push", "prepublishOnly1": "npm run check && npm run before-build && lerna run build ", "before-build": "cd ./packages/core/pipeline && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"", "deploy1": "node --experimental-json-modules deploy.js ",