-
Notifications
You must be signed in to change notification settings - Fork 28
71 lines (61 loc) · 1.89 KB
/
migrations.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
name: migrations
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
workflow_dispatch:
env:
# Setting these variables allows .NET CLI to use rich color codes in console output
TERM: xterm
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
# Skip boilerplate output
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
script:
strategy:
matrix:
app:
- Api
- AdminConsole
include:
- app: Api
ef-context: DbGlobalMsSqlContext
- app: AdminConsole
ef-context: MssqlConsoleDbContext
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install .NET
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
- name: Install Entity Framework toolkit
run: dotnet tool install dotnet-ef --global
- name: Generate script
run: >
dotnet ef migrations script
--configuration Release
--project src/${{ matrix.app }}
--context ${{ matrix.ef-context }}
--idempotent
--output ${{ matrix.app }}.sql
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ${{ matrix.app }}-${{ matrix.ef-context }}
path: ${{ matrix.app }}.sql
- name: Produce summary
run: |
echo "### Idempotent migrations for ${{ matrix.app }} (${{ matrix.ef-context }})" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`sql" >> $GITHUB_STEP_SUMMARY
cat ${{ matrix.app }}.sql >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY