Files
certd/.github/workflows/deploy-demo.yml
2026-01-16 09:30:47 +08:00

59 lines
1.7 KiB
YAML

name: deploy-demo
on:
push:
branches: ['v2-dev']
paths:
- "trigger/deploy.trigger"
workflow_run:
workflows: [ "build-image" ]
types:
- completed
# schedule:
# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
# - cron: '17 19 * * *'
permissions:
contents: read
jobs:
deploy-certd-demo:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: v2-dev
- name: get_certd_version
id: get_certd_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs');
const path = require('path');
const jsonFilePath = "./packages/ui/certd-server/package.json";
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
const pkg = JSON.parse(jsonContent)
console.log("certd_version:",pkg.version);
return pkg.version
- uses: GuillaumeFalourd/wait-sleep-action@v1
with:
time: '10' # for 60 seconds
- name: deploy-certd-demo
uses: tyrrrz/action-http-request@master
with:
# 通过webhook 触发 certd-demo来部署
url: ${{ secrets.WEBHOOK_CERTD_DEMO }}
method: POST
headers: |
Content-Type: application/json
body: |
{
"CERTD_VERSION": "${{steps.get_certd_version.outputs.result}}"
}
retry-count: 3
retry-delay: 5000