-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (110 loc) · 3.75 KB
/
shared.full-deployment.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Deploy environment
on:
workflow_call:
inputs:
deploy_twitposter:
description: 'Indicates if the Twitposter app should be deployed'
required: false
type: string
deploy_email_sender:
description: 'Indicates if the Email sender app should be deployed'
required: false
type: string
deploy_functions:
description: 'Indicates if the functions app should be deployed'
required: false
type: string
environment:
description: 'The environment to deploy to'
required: true
type: string
workspace:
description: 'The Terraform workspace'
required: true
type: string
permissions:
contents: 'read'
packages: 'write'
actions: read
jobs:
infra:
name: 'Terraform [${{ inputs.environment }}]'
uses: ./.github/workflows/shared.infrastructure.deploy.yml
with:
workspace: ${{ inputs.workspace }}
environment: ${{ inputs.environment }}
secrets: inherit
deploy_twitposter:
if: ${{ inputs.deploy_twitposter == 'true' }}
needs: [ infra ]
uses: ./.github/workflows/shared.twitposter.deploy.yml
with:
environment: ${{ inputs.environment }}
twitposter_image: 'ghcr.io/wallyrion/twitposter:${{github.sha}}'
APP_SERVICE_NAME: ${{ needs.infra.outputs.APP_SERVICE_NAME }}
secrets: inherit
deploy_email_sender:
if: ${{ inputs.deploy_email_sender == 'true' }}
needs: [ infra ]
uses: ./.github/workflows/shared.twitposter-emailsender.deploy.yml
with:
environment: ${{ inputs.environment }}
image: 'ghcr.io/wallyrion/twitposter-emailsender:${{github.sha}}'
APP_SERVICE_NAME: ${{ needs.infra.outputs.APP_SERVICE_NAME_EMAIL_SENDER }}
secrets: inherit
deploy_dev_functions:
if: ${{ inputs.deploy_functions == 'true' }}
needs: [ infra ]
uses: ./.github/workflows/shared.functions.deploy.yml
with:
environment: ${{ inputs.environment }}
APP_SERVICE_NAME: ${{ needs.infra.outputs.APP_SERVICE_NAME_FUNCTIONS }}
secrets: inherit
finish_deploy_twitposter:
needs: [ deploy_twitposter ]
runs-on: ubuntu-latest
steps:
- name: 'Finish Twitposter deployment'
run: echo "Twitposter deployed successfully"
finish_deploy_email_sender:
needs: [ deploy_email_sender ]
runs-on: ubuntu-latest
steps:
- name: 'Finish Email sender deployment'
run: echo "Email sender deployed successfully"
finish_deploy_functions:
needs: [ deploy_dev_functions ]
runs-on: ubuntu-latest
steps:
- name: 'Finish Functions deployment'
run: echo "Functions deployed successfully"
wait_for_deployment:
needs: [ infra ]
runs-on: ubuntu-latest
steps:
- name: 'Wait for deployment'
uses: yogeshlonkar/wait-for-jobs@v0
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
ignore-skipped: 'true'
interval: '3000'
no-max-ttl: 'true'
ttl: '60'
jobs: |
Full ${{inputs.environment}} deployment / finish_deploy_twitposter
Full ${{inputs.environment}} deployment / finish_deploy_email_sender
Full ${{inputs.environment}} deployment / finish_deploy_functions
run_e2e_tests:
needs: [infra, wait_for_deployment]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: Test - TwitPoster
env:
ASPNETCORE_ENVIRONMENT: Production
TWITPOSTER_API_BASE_URL: 'https://${{ needs.infra.outputs.APP_SERVICE_NAME }}.azurewebsites.net'
run: dotnet test --verbosity normal ./TwitPoster.AutoTests -c Release