Skip to content

Commit

Permalink
♻️ Improve workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontaylordev committed Jul 11, 2023
1 parent d738687 commit 906e12d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 82 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/build+deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Build+Deploy

on:
workflow_dispatch:
push:
branches: [ main ]

Expand All @@ -10,21 +9,13 @@ jobs:
# Build the website
build:
uses: ./.github/workflows/build.yml

# Publish the website
publish:
uses: ./.github/workflows/publish.yml
needs: [build]

# Generate the EF bundle
efbundle:
uses: ./.github/workflows/efbundle.yml
needs: [build]
with:
build-artifacts: true

# Deploy to the test environment.
deploy-test:
uses: ./.github/workflows/deploy.yml
needs: [publish]
needs: [ build ]
with:
environmentType: Test
resourceGroupName: CleanArchitectureTest
Expand All @@ -38,7 +29,7 @@ jobs:
# Deploy to the production environment.
deploy-prod:
uses: ./.github/workflows/deploy.yml
needs: [deploy-test]
needs: [ deploy-test ]
with:
environmentType: Production
resourceGroupName: CleanArchitectureProduction
Expand Down
42 changes: 41 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: Build

on:
workflow_call:
pull_request:
branches: [ main ]

workflow_call:
inputs:
build-artifacts:
type: boolean
required: true
default: false

jobs:
build:

Expand Down Expand Up @@ -39,3 +45,37 @@ jobs:

- name: Test
run: dotnet test --no-build --configuration Release --filter "FullyQualifiedName!~AcceptanceTests"

- name: Create Website Artifact
if: ${{ inputs.build-artifacts == true }}
run: |
dotnet publish --configuration Release --runtime win-x86 --self-contained --output ./publish
cd publish
zip -r ./publish.zip .
working-directory: ./src/WebUI/

- name: Upload Website Artifact
if: ${{ inputs.build-artifacts == true }}
uses: actions/upload-artifact@v2
with:
name: website
path: ./src/WebUI/publish/publish.zip
if-no-files-found: error

- name: Create EFBundle Artifact
if: ${{ inputs.build-artifacts == true }}
run: |
dotnet new tool-manifest
dotnet tool install dotnet-ef --prerelease
dotnet ef migrations bundle --configuration Release -p ./src/Infrastructure/ -s ./src/WebUI/ -o efbundle.exe
zip -r ./efbundle.zip efbundle.exe
env:
SkipNSwag: True

- name: Upload EFBundle Artifact
if: ${{ inputs.build-artifacts == true }}
uses: actions/upload-artifact@v2
with:
name: efbundle
path: ./efbundle.zip
if-no-files-found: error
36 changes: 0 additions & 36 deletions .github/workflows/efbundle.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/publish.yml

This file was deleted.

0 comments on commit 906e12d

Please sign in to comment.