Skip to content

Main

Main #3893

Workflow file for this run

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 }}