-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (115 loc) · 4.04 KB
/
deploy.yml
File metadata and controls
120 lines (115 loc) · 4.04 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: deploy
# defaults:
# run:
# working-directory: "Benday.Demo123"
on:
workflow_dispatch:
inputs:
toEnvironment:
description: 'deploy to which environment?'
required: true
default: 'dev'
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
env:
AZURE_WEBAPP_NAME: bdcgithubactiondemo # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: 'Benday.Demo123/src/Benday.Demo123.WebUi' # set this to the path to your web app project, defaults to the repository root
PROJECT_TO_PUBLISH_PATH: 'Benday.Demo123/src/Benday.Demo123.WebUi'
DOTNET_VERSION: '3.1.301' # set this to the dot net version to use
#
# I really want to do this but it doesn't seem to work
# PUBLISH_TO_PATH: '$RUNNER_WORKSPACE/published'
MYGITHUBTOKEN: '${{ github.token }}'
jobs:
deploy:
runs-on: ubuntu-latest
# runs-on: self-hosted
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: Pa$$word
MSSQL_PID: Standard
ports:
- 1433:1433
steps:
# - uses: actions/checkout@v2
- run: |
echo "toEnvironment: ${{ github.event.inputs.toEnvironment }}"
- name: print environment vars
run: env
- name: print default working directory
run: pwd
- name: run an ls -l
run: ls -lR
working-directory: '${{ github.workspace }}'
- name: Inspect contexts
run: |
echo ""
echo "The github context is:"
echo "${{ toJson(github) }}"
echo ""
echo "The job context is:"
echo "${{ toJson(job) }}"
echo ""
echo "The steps context is:"
echo "${{ toJson(steps) }}"
echo ""
echo "The runner context is:"
echo "${{ toJson(runner) }}"
echo ""
echo "The strategy context is:"
echo "${{ toJson(strategy) }}"
echo ""
echo "The matrix context is:"
echo "${{ toJson(matrix) }}"
echo ""
#
#
- name: print environment vars again
run: env
# - name: Setup .NET Core
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: ${{ env.DOTNET_VERSION }}
# - name: Restore dotnet tools
# run: dotnet tool restore
# - name: Install dependencies for .net core
# run: dotnet restore
- name: Download artifact from a github workflow
uses: benday-inc/download-latest-artifact@v1.0.1
with:
token: '${{ env.MYGITHUBTOKEN }}'
repository_owner: 'benday'
repository_name: 'actionsdemo'
workflow_name: 'build'
branch_name: 'master'
download_path: '${{ github.workspace }}/temp'
download_filename: 'actionsdemo-artifact.zip'
- name: run an ls -l after download
run: ls -lR
working-directory: '${{ github.workspace }}'
- name: mkdir for unzipped artifact
run: mkdir '${{ github.workspace }}/actionsdemo-artifact'
- name: unzip artifact
run: unzip '${{ github.workspace }}/temp/actionsdemo-artifact.zip' -d '${{ github.workspace }}/actionsdemo-artifact'
- name: run an ls -l after download
run: ls -lR
working-directory: '${{ github.workspace }}'
- name: Edit .net core database connection string in appsettings.json
uses: benday-inc/edit-dbconnstr-in-appsettings@v1.1
with:
name: 'default'
connectionstring: 'Server=localhost; Database=Benday.Demo123; User Id=sa; TrustServerCertificate=true; Password=${{ secrets.SQL_SERVER_PASSWORD }};'
pathtosettingsfile: '${{ github.workspace }}/actionsdemo-artifact/appsettings.json'
- name: Deploy EF Core migrations from a DLL
uses: benday-inc/deploy-ef-core-migration@v1.0
with:
path_to_directory: '${{ github.workspace }}/actionsdemo-artifact'
migrations_dll: 'Benday.Demo123.Api.dll'
migrations_namespace: 'Benday.Demo123.Api'
startup_dll: 'Benday.Demo123.WebUi.dll'
dbcontext_class_name: 'MyDbContext'