Continuous Integration + Deployment #4393
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration + Deployment | |
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: read | |
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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
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@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Pull DB Image | |
run: docker pull public.ecr.aws/bitnami/mariadb:10.4 | |
- name: Build | |
id: build | |
run: | | |
dotnet run \ | |
--verbosity minimal \ | |
--project cicd/Cicd.BuildDriver/Cicd.BuildDriver.csproj -- \ | |
--version ${{ github.run_number }} | |
- name: Test | |
run: | | |
dotnet test \ | |
--no-build \ | |
--logger trx | |
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/identity/.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/identity/.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/identity/.github/workflows/deploy.yml@master | |
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} | |
needs: | |
- build | |
- deploy-dev | |
- update-client | |
with: | |
environment: Production | |
artifacts-location: ${{ needs.build.outputs.artifacts-location }} | |
secrets: | |
role: ${{ secrets.AWS_PROD_ROLE }} | |
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }} |