Merge branch 'features/AddEvent' of https://github.com/bogdanbrudiu/H… #47
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: Commit and push changes | |
| run: | | |
| git config --global user.name "CD bot" | |
| git config --global user.email "" | |
| echo %date% %time% >> HamEvent/App_Data/dbtestfile.txt | |
| git add HamEvent/App_Data/dbtestfile.txt | |
| git commit -m "update db file [skip actions]" | |
| - name: Push change | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} | |
| - 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: 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: 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 }} | |
| - name: Backup DB | |
| run: | | |
| git config --global user.name "CD bot" | |
| git config --global user.email "" | |
| echo %date% %time% >> HamEvent/App_Data/dbtestfile_.txt | |
| git add HamEvent/App_Data/dbtestfile_.txt | |
| git commit -m "update db file [skip actions]" | |
| - name: Push change | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} | |
| - 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 }} | |
| - 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 }} | |