-
Notifications
You must be signed in to change notification settings - Fork 37
61 lines (53 loc) · 1.65 KB
/
runMigrations.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
name: Run migrations
on:
workflow_call:
inputs:
PullRequestCheckout:
required: false
type: boolean
Environment:
required: true
type: string
CheckoutRef:
required: false
type: string
default: "main"
secrets:
ClientId:
required: true
ClientSecret:
required: true
defaults:
run:
working-directory: backend/api
jobs:
run_migrations:
environment: ${{ inputs.Environment }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.CheckoutRef }}
# Checks out to main branch by default, so we need to manually checkout to the PR the comment was made on
# in order to do the update database on the new migrations.
# We don't have the ref in the IssueComment trigger so we need to check out the pr number
- name: Checkout Pull Request
if: ${{ inputs.PullRequestCheckout }}
run: gh pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Build project and dependencies
run: dotnet build
- name: Install dotnet ef tool
run: dotnet tool install -g dotnet-ef --version 8.0.0
- name: Update database
run: dotnet ef database update --no-build --verbose
env:
AZURE_CLIENT_ID: ${{ secrets.ClientId }}
AZURE_CLIENT_SECRET: ${{ secrets.ClientSecret }}
ASPNETCORE_ENVIRONMENT: ${{ vars.AspNetEnvironment }}