-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (58 loc) · 1.99 KB
/
Copy pathnotify-deploy-project.yaml
File metadata and controls
66 lines (58 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Notify WebProtege Deploy
on:
workflow_call:
inputs:
service:
required: true
type: string
version:
required: true
type: string
branch_var:
required: true
type: string
secrets:
PROTEGE_PROJECT_CLIENT_ID:
required: true
PROTEGE_PROJECT_CLIENT_SECRET:
required: true
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PROTEGE_PROJECT_CLIENT_ID }}
private-key: ${{ secrets.PROTEGE_PROJECT_CLIENT_SECRET }}
owner: protegeproject
repositories: webprotege-deploy
- name: Trigger workflow_call in webprotege-deploy
run: |
SERVICE="${{ inputs.service }}"
VERSION="${{ inputs.version }}"
BRANCH="${{ inputs.branch_var }}"
echo "Triggering webprotege-deploy with service=$SERVICE and version=$VERSION"
response=$(curl -s -w "%{http_code}" -X POST \
-H "Authorization: token ${{ steps.app-token.outputs.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/protegeproject/webprotege-deploy/actions/workflows/update-compose.yml/dispatches \
-d '{
"ref": "'"$BRANCH"'",
"inputs": {
"service": "'"$SERVICE"'",
"version": "'"$VERSION"'",
"branch": "'"$BRANCH"'"
}
}')
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "HTTP Status Code: $http_code"
echo "Response Body: $body"
if [[ "$http_code" -lt 200 || "$http_code" -ge 300 ]]; then
echo "Error: API call failed with status code $http_code"
exit 1
else
echo "API call successful, status code: $http_code"
fi