-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (126 loc) · 3.99 KB
/
main.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Main
on:
push:
branches:
- "master"
tags:
- "*"
workflow_dispatch:
pull_request:
types: [opened, synchronize]
schedule:
- cron: "0 0 * * *"
env:
CI: "true"
DOTNET_NOLOGO: "true"
CONFIGURATION: Release
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true"
DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY: "false"
permissions:
contents: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
outputs:
artifacts-location: ${{ steps.build.outputs.artifacts-location }}
version: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_SHARED_ROLE }}
aws-region: us-east-1
- uses: actions/setup-node@v3
with:
node-version: "14"
- name: Install CDK
run: npm install --global cdk
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
- name: Display .NET Info
run: dotnet --info
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Restore
run: dotnet restore
- name: Build
id: build
run: |
dotnet run \
--no-restore \
--verbosity minimal \
--project cicd/Cicd.BuildDriver/Cicd.BuildDriver.csproj -- \
--version ${{ github.run_number }}
- name: Test
run: |
dotnet test \
--logger trx \
--no-build
- name: Upload Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./obj/Tests/Results/coverage.cobertura.xml
fail_ci_if_error: true
- name: Discord Failure Notification
uses: Ilshidur/action-discord@master
if: failure() && (github.event_name == 'push' || github.event_name == 'schedule')
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_EMBEDS: |
[
{
"title": "[${{ github.repository }}] Build Failed",
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"description": "An error occurred while building ${{ github.repository }}.",
"color": 12720135
}
]
start-dev-db:
uses: cythral/mutedac/.github/workflows/start.yml@master
needs: build
with:
environment: Development
secrets:
role: ${{ secrets.AWS_DEV_ROLE }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}
deploy-dev:
uses: cythral/brighid-commands/.github/workflows/deploy.yml@master
needs:
- build
- start-dev-db
with:
environment: Development
artifacts-location: ${{ needs.build.outputs.artifacts-location }}
secrets:
role: ${{ secrets.AWS_DEV_ROLE }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}
update-client:
uses: cythral/brighid-commands/.github/workflows/update-client.yml@master
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
needs: build
with:
version: ${{ needs.build.outputs.version }}
artifacts-location: ${{ needs.build.outputs.artifacts-location }}
secrets:
role: ${{ secrets.AWS_SHARED_ROLE }}
token: ${{ secrets.GH_TOKEN }}
deploy-prod:
uses: cythral/brighid-commands/.github/workflows/deploy.yml@master
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
needs:
- build
- update-client
- deploy-dev
with:
environment: Production
artifacts-location: ${{ needs.build.outputs.artifacts-location }}
secrets:
role: ${{ secrets.AWS_PROD_ROLE }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}