-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
58 lines (53 loc) · 1.8 KB
/
action.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
name: "Warren - .NET Migrations"
description: "Installs the dotnet ef global tool and applies migrations to the database"
branding:
icon: "database"
color: "red"
inputs:
project-path:
description: "The path for the project that holds the migrations folder"
required: true
startup-project-path:
description: "The startup project of the application"
required: true
dotnet-ef-version:
description: "The version of dotnet-ef tool"
required: false
default: ""
context:
description: "The DbContext class name"
required: true
connection:
description: "The connection string for the database to apply migrations"
required: true
runs:
using: composite
steps:
- name: Clear previous tools installation
shell: bash
run: dotnet tool uninstall --global dotnet-ef || true
- name: Install dotnet ef tool
if: ${{ inputs.dotnet-ef-version == '' }}
shell: bash
run: dotnet tool install --global dotnet-ef
- name: Install dotnet ef tool
if: ${{ inputs.dotnet-ef-version != '' }}
shell: bash
env:
VERSION: ${{ inputs.dotnet-ef-version }}
run: dotnet tool install --global dotnet-ef --version $VERSION
- name: Update database
shell: bash
env:
PROJECT_PATH: ${{ inputs.project-path }}
STARTUP_PROJECT_PATH: ${{ inputs.startup-project-path }}
CONTEXT: ${{ inputs.context }}
CONNECTION: ${{ inputs.connection }}
run: |
export PATH=$PATH:$HOME/.dotnet/tools
. ~/.bashrc
dotnet tool restore
dotnet ef database update --verbose --project=$PROJECT_PATH --startup-project=$STARTUP_PROJECT_PATH --context $CONTEXT --connection $CONNECTION
- name: Uninstall dotnet-ef tool
shell: bash
run: dotnet tool uninstall --global dotnet-ef