-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (59 loc) · 2.22 KB
/
develop_bedbrigadedev.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
69
70
71
72
73
74
75
name: Build, Test, and Deploy to Develop
on:
push:
branches:
- develop # Adjust this to your branch name
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set environment variable from secret
run: echo "GOLD=${{ secrets.GOLD }}" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Adjust the version if needed
- name: Replace Connection String in appsettings.Development.json
run: |
sed -i 's#"DefaultConnection": ".*"#"DefaultConnection": "${{ secrets.DEV_CONNECTION_STRING }}"#' ./BedBrigade.Client/appsettings.Development.json
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --configuration Release --no-restore
- name: Run tests
run: dotnet test
- name: Create TmpFolder
run: mkdir TmpFolder
- name: Create app_offline.htm
run: echo "<html><body><h1>The application is offline for maintenance</h1></body></html>" > ./TmpFolder/app_offline.htm
- name: Upload file app_offline.htm
uses: tomasbkk/action-ftp-upload@v1.0
with:
user: ${{ secrets.FTP_DEV_USERNAME }}
password: ${{ secrets.FTP_DEV_PASSWORD }}
host: ${{ secrets.FTP_DEV_HOST }}
src: ./TmpFolder/app_offline.htm
dest: app_offline.htm
- name: Wait for 10 seconds
run: sleep 10
- name: Publish
run: dotnet publish --configuration Release --output ./publish
- name: FTP Deploy
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ${{ secrets.FTP_DEV_HOST }}
username: ${{ secrets.FTP_DEV_USERNAME }}
password: ${{ secrets.FTP_DEV_PASSWORD }}
local-dir: ./publish/
server-dir: /
protocol: ftp
- name: Delete app_offline.htm
uses: StephanThierry/ftp-delete-action@v2.1
with:
host: ${{ secrets.FTP_DEV_HOST }}
user: ${{ secrets.FTP_DEV_USERNAME }}
password: ${{ secrets.FTP_DEV_PASSWORD }}
remoteFiles: "app_offline.htm"
ignoreSSL: "1"