-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (52 loc) · 1.87 KB
/
SQL-MI-CICD.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
name: SQL-MI-CICD
on:
push:
branches:
- "NA"
workflow_dispatch:
env:
SQL_PROJECT_NAME: DemoSqlProj
SQL_ARTIFACT_NAME: SqlDb
jobs:
build:
name: "Build"
runs-on: self-hosted
env:
DOTNET_INSTALL_DIR: "./.dotnet" # https://github.com/actions/setup-dotnet/issues/327#issuecomment-1278572993
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
- name: Build DACPAC
run: dotnet build "data/${{ env.SQL_PROJECT_NAME }}/${{ env.SQL_PROJECT_NAME }}.sqlproj" --configuration Release
- name: Upload artifact
uses: actions/upload-artifact@v3.1.2
with:
name: ${{ env.SQL_ARTIFACT_NAME }}
path: data/${{ env.SQL_PROJECT_NAME }}/bin/Release
deployDev:
needs: build
name: Deploy
runs-on: self-hosted
steps:
- name: Install Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_SP_CREDENTIALS }}
- name: Download Dacpac Artifact
uses: actions/download-artifact@v3.0.2
with:
name: ${{ env.SQL_ARTIFACT_NAME }}
# - name: Azure SQL Deploy
# uses: Azure/sql-action@v2.1
# with:
# connection-string: "Server=tcp:${{ vars.SQL_SERVER_NAME }}.database.windows.net,1433;Initial Catalog=${{ vars.SQL_INITIAL_CATALOG }};Persist Security Info=False;User ID=${{ vars.SQL_ADMIN_USER }};Password=${{ secrets.SQL_ADMIN_PASSWORD }};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
# path: "./${{ inputs.sqlProjectName }}.dacpac"
# action: publish
# arguments: "/p:DropObjectsNotInSource=true"