Merge pull request #328 from GregFinzer/feature/spinner #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |