-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 2.49 KB
/
deploy.yml
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
67
68
69
70
71
72
73
74
75
name: Deploy Frontera App
on:
workflow_run:
workflows: ["Create Release"]
types:
- completed
workflow_dispatch:
inputs:
version:
description: 'Version to deploy (e.g., v1.2.3)'
required: true
type: string
deploy_middleware:
description: 'Deploy middleware component'
required: false
type: boolean
default: true
jobs:
deploy:
runs-on: ubuntu-latest
if: |
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
github.event_name == 'workflow_dispatch'
steps:
- name: Download workflow data
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v4
with:
name: workflow-data
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Read workflow data
id: workflow_data
if: github.event_name == 'workflow_run'
run: |
next_version=$(cat workflow-data.json | jq -r .next_version)
echo "next_version=${next_version}" >> $GITHUB_OUTPUT
- name: Set version
id: set_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${{ steps.workflow_data.outputs.next_version }}" >> $GITHUB_OUTPUT
fi
- name: Set deploy_middleware flag
id: set_deploy_middleware
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "deploy_middleware=${{ inputs.deploy_middleware }}" >> $GITHUB_OUTPUT
else
echo "deploy_middleware=true" >> $GITHUB_OUTPUT
fi
- name: Trigger Frontera App Deployment
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.FE_TESTS_GITHUB_TOKEN }}
repository: customeros/cloud
event-type: deploy-frontera-app
client-payload: '{"version": "${{ steps.set_version.outputs.version }}"}'
- name: Trigger Middleware Deployment
if: steps.set_deploy_middleware.outputs.deploy_middleware == 'true'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.FE_TESTS_GITHUB_TOKEN }}
repository: customeros/cloud
event-type: deploy-frontera-middleware
client-payload: '{"version": "${{ steps.set_version.outputs.version }}"}'