Build #72
Workflow file for this run
This file contains hidden or 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
| # This workflow will build a .NET project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
| name: Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| Build_Test_Deploy: | |
| runs-on: windows-latest | |
| environment: test | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: recursive | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: 6.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore | |
| - name: Test | |
| run: dotnet test --no-build --verbosity normal | |
| - name: App Settings Variable Substitution | |
| uses: microsoft/variable-substitution@v1 | |
| with: | |
| files: '**/appsettings.json' | |
| env: | |
| MailerSettings.From: ${{ secrets.MAILER_SETTINGS_FROM }} | |
| MailerSettings.Username: ${{ secrets.MAILER_SETTINGS_USERNAME }} | |
| MailerSettings.Password: ${{ secrets.MAILER_SETTINGS_PASSOWRD }} | |
| MailerSettings.Host: ${{ secrets.MAILER_SETTINGS_HOST }} | |
| MailerSettings.Port: ${{ secrets.MAILER_SETTINGS_PORT }} | |
| MailerSettings.EnableSSL: ${{ secrets.MAILER_SETTINGS_ENABLESSL }} | |
| Token.Secret: ${{ secrets.TOKEN_SECRET }} | |
| - name: Stop App Pool | |
| uses: bogdanbrudiu/simply-web-deploy/Stop@main | |
| with: | |
| website-name: ${{ secrets.WEBSITE_NAME }} | |
| server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }} | |
| server-username: ${{ secrets.SERVER_USERNAME }} | |
| server-password: ${{ secrets.SERVER_PASSWORD }} | |
| - name: Fetch App Pool | |
| uses: bogdanbrudiu/simply-web-deploy/Fetch@main | |
| with: | |
| website-name: ${{ secrets.WEBSITE_NAME }} | |
| server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }} | |
| server-username: ${{ secrets.SERVER_USERNAME }} | |
| server-password: ${{ secrets.SERVER_PASSWORD }} | |
| target-path: '\fetched\' | |
| source-path: '""' | |
| - name: Backup DB | |
| run: | | |
| git config --global user.name "CD bot" | |
| git config --global user.email "" | |
| copy fetched/App_Data/QSOs.db HamEvent/App_Data/QSOs.db | |
| $NOW=& Get-Date -format yyyy-MM-dd | |
| echo "New backup done on $NOW" >> HamEvent/App_Data/dbbackup_log | |
| git add HamEvent/App_Data/QSOs.db | |
| git add HamEvent/App_Data/dbbackup_log | |
| git commit -m "update db file [skip actions]" | |
| - name: Push change | |
| if: ${{ github.ref!='refs/heads/main' }} | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} | |
| - name: Publish | |
| run: dotnet publish HamEvent/HamEvent.csproj --configuration Release --framework net8.0 --output ./publish --runtime win-x64 --self-contained true -p:PublishTrimmed=false -p:PublishSingleFile=false | |
| - name: Deploy App Pool | |
| uses: bogdanbrudiu/simply-web-deploy/Deploy@main | |
| with: | |
| website-name: ${{ secrets.WEBSITE_NAME }} | |
| server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }} | |
| server-username: ${{ secrets.SERVER_USERNAME }} | |
| server-password: ${{ secrets.SERVER_PASSWORD }} | |
| target-path: '\wwwroot\' | |
| source-path: '\publish\' | |
| - name: Start App Pool | |
| uses: bogdanbrudiu/simply-web-deploy/Start@main | |
| with: | |
| website-name: ${{ secrets.WEBSITE_NAME }} | |
| server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }} | |
| server-username: ${{ secrets.SERVER_USERNAME }} | |
| server-password: ${{ secrets.SERVER_PASSWORD }} | |