generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 2.54 KB
/
setup-database.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
name: Setup Database
run-name: Setup Database [${{inputs.selected_environment}}]
on:
workflow_dispatch:
inputs:
selected_environment:
type: environment
description: Select environment
default: test
block_data_loss:
type: boolean
description: Block on possible data loss
default: true
deploy_database_resource:
type: boolean
description: Run deployment of SQL Server resource
default: true
publish_database_project:
type: boolean
description: Run build and publish the SQL Project
default: true
jobs:
setup-server-and-database-resource:
if: ${{ github.event.inputs.deploy_database_resource == 'true' }}
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.selected_environment }}
steps:
- uses: actions/checkout@v2
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Setup SQL Server & Database Resource
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ fromJSON(secrets.AZURE_CREDENTIALS)['subscriptionId'] }}
resourceGroupName: ${{ secrets.AZURE_RESOURCE_GROUP }}
template: ./.bicep/sql/deployGhMgmtSqlDatabase.bicep
parameters: activeEnv=${{github.event.inputs.selected_environment}} serverName=${{ secrets.DATABASE_SERVER_NAME }} administratorLogin=${{ secrets.DATABASE_SERVER_USERNAME }} administratorLoginPassword=${{ secrets.DATABASE_SERVER_PASSWORD }} databaseName=${{ vars.DATABASE_NAME }}
failOnStdErr: false
scope: resourcegroup
build-and-publish-database-project:
if: ${{ github.event.inputs.publish_database_project == 'true' }}
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.selected_environment }}
steps:
- uses: actions/checkout@v2
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/[email protected]
if: ${{ github.event.inputs.publish_database_project }}
with:
connection-string: Server=${{ secrets.DATABASE_SERVER_NAME }}.database.windows.net;Initial Catalog=${{ vars.DATABASE_NAME }};Persist Security Info=False;User ID=${{ secrets.DATABASE_SERVER_USERNAME }};Password=${{ secrets.DATABASE_SERVER_PASSWORD }};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
project-file: 'src/sqldb/sqldb.sqlproj'
arguments: '/p:BlockOnPossibleDataLoss=${{github.event.inputs.block_data_loss}}'