From 97589d0c8931c45af62d049807dc4f1313933ee8 Mon Sep 17 00:00:00 2001 From: Phap Dieu Duong Date: Wed, 23 Aug 2023 22:20:07 +0800 Subject: [PATCH] Create dotnet.yml --- .github/workflows/dotnet.yml | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..9b96353 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,60 @@ +# 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: .NET + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Go to source folder + run: cd Source + - name: Restore dependencies + run: dotnet restore + - name: 🫧 Build + run: dotnet build --no-restore + + - name: 🪄 Publish + run: dotnet publish -c Release -o _Output + + - name: 🛫 Upload a build artifact + uses: actions/upload-artifact@v3 + with: + name: website + path: ./Source/_Output/** + if-no-files-found: error + + deploy_prod: + needs: build + runs-on: ubuntu-latest + steps: + - name: 🚡 Download a Build Artifact + uses: actions/download-artifact@v3 + with: + name: website + path: ./Source/_Output + + - name: 🚀 Deploy + uses: SamKirkland/FTP-Deploy-Action@v4.3.4 + with: + server: ${{ secrets.FTP_SERVER }} + username: ${{ secrets.FTP_USER }} + password: ${{ secrets.FTP_PASSWORD }} + local-dir: ./Website/bin/Release/net7.0 + server-dir: ./httpdocs/phap + exclude: | + **/.git* + **/.git*/** + **/node_modules/** +