pull/148/head
xiaojunnuo 2024-07-26 23:43:41 +08:00
parent c26d3e9c38
commit 6e594ee66e
3 changed files with 31 additions and 38 deletions

View File

@ -67,23 +67,3 @@ jobs:
tags: | tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}} 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}`)

View File

@ -1,4 +1,4 @@
name: build-image name: trigger-demo
on: on:
push: push:
branches: ['v2'] branches: ['v2']
@ -15,24 +15,37 @@ jobs:
deploy-certd-demo: deploy-certd-demo:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- run: | - name: get_certd_version
npm install -g axios id: get_certd_version
- name: trigger deploy demo
uses: actions/github-script@v6 uses: actions/github-script@v6
with: with:
result-encoding: string result-encoding: string
script: | script: |
const fs = require('fs'); const fs = require('fs');
const http = require('axios'); const path = require('path');
const webhook = "http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG" const pnpmWorkspace = "./pnpm-workspace.yaml";
await http({ fs.unlinkSync(pnpmWorkspace)
url: webhook, const jsonFilePath = "./packages/ui/certd-server/package.json";
method: 'POST', const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
headers: { const pkg = JSON.parse(jsonContent)
"Content-Type": "application/json" console.log("certd_version:",pkg.version);
}, return pkg.version
data: { - uses: GuillaumeFalourd/wait-sleep-action@v1
'CERTD_VERSION': '${{steps.get_certd_version.outputs.result}}' with:
time: '10' # for 60 seconds
- name: Send HTTP request
id: request
uses: tyrrrz/action-http-request@master
with:
url: http://flow-openapi.aliyun.com/pipeline/webhook/lzCzlGrLCOHQaTMMt0mG
method: POST
headers: |
Content-Type: application/json
body: |
{
"CERTD_VERSION": "${{steps.get_certd_version.outputs.result}}"
} }
}) retry-count: 3
console.log(`webhook success:${webhook}`) retry-delay: 5000

View File

@ -1 +1 @@
1 2