This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
Sync master #26
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 | |
on: | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: read | |
# env: | |
# DEPLOYMENT_FOLDER: C:\inetpub\wwwroot\SWD-Laundry-Project\ | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.0.401' # replace with your .NET version | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
# - name: Publish | |
# run: dotnet publish --configuration Release --output ./publish /p:RuntimeIdentifier=win-x64 /p:TargetFramework=net7.0 | |
# - name: Archive Artifacts | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: publish | |
# path: ./publish | |
# - name: Deploy to EC2 | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.HOST }} | |
# username: ${{ secrets.USERNAME }} | |
# key: ${{ secrets.KEY }} | |
# script: | |
# Stop-Service -Name 'W3SVC' -Force | |
# Remove-Item -Path '${{env.DEPLOYMENT_FOLDER}}*' -Force | |
# Copy-Item -Path './publish/*' -Destination '${{env.DEPLOYMENT_FOLDER}}' | |
# $json = Get-Content '${{env.DEPLOYMENT_FOLDER}}appsettings.Production.json' | ConvertFrom-Json | |
# $json | Add-Member -Type NoteProperty -Name 'ConnectionStrings' -Value @{DefaultConnection = "Server=${{ secrets.DATABASE }};Database=Laundry;Trusted_Connection=False;MultipleActiveResultSets=true;User ID=${{ secrets.DATABASE_USERNAME }};Password=${{ secrets.DATABASE_PASSWORD }};TrustServerCertificate=true"} | |
# $json | ConvertTo-Json -Depth 20 | Set-Content '${{env.DEPLOYMENT_FOLDER}}appsettings.Production.json' | |
# Start-Service -Name 'W3SVC' | |