diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..16cc231 --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,28 @@ +name: "Deploy to nuget" +on: + push: + branches: + - "master" +env: + PROJECT_PATH: "PgBackup.csproj" + PACK_OUTPUT_DIR: ${{ github.workspace }}\output + NUGET_SOURCE_URL: https://www.nuget.org/packages/PgBackup.Net/1.0.0 +jobs: + deploy: + name: "deploy" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout" + uses: actions/checkout@v3 + - name: "Install dotnet standard" + uses: actions/setup-dotnet@v3 + with: + dotnet-version: "6.0" + - name: "Restore Packages" + run: dotnet restore ${{ env.PROJECT_PATH }} + - name: "Build Project" + run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release + - name: "Pack Project" + run: dotnet pack ${{ env.PROJECT_PATH }} --no-restore --no-build --configuration Release --include-symbols --output ${{ env.PACK_OUTPUT_DIR }} + - name: "Push Package" + run: dotnet nuget push ${{ env.PACK_OUTPUT_DIR }}\*.nupkg -k ${{ secrets.NUGET_AUTH_TOKEN }} -s ${{ env.NUGET_SOURCE_URL }} diff --git a/Enums/Enums.cs b/Enums/Enums.cs index 6c83e88..3bd6d90 100644 --- a/Enums/Enums.cs +++ b/Enums/Enums.cs @@ -6,6 +6,5 @@ public enum BackupFileFormat Tar, Directory, Custom - } } \ No newline at end of file diff --git a/README.md b/README.md index 97f766d..447b6a7 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,38 @@ - # PostgreSQL backup -This package is a simple wrapper of postgresql's pg_dump client tool and can be used to take postgres database backups on demand from your .NET core or .NET framework applications. -Please refer https://www.postgresql.org/docs/current/libpq-pgpass.html for setting up the .pgpass file for the package to use to authentication to the database server, +This package is a simple wrapper of postgresql's pg_dump client tool and can be used to take postgres database backups on demand from a .NET core application. +Please refer https://www.postgresql.org/docs/current/libpq-pgpass.html for setting up the .pgpass file for the package to use to authentication to the database server, ## Installation Instructions + Nuget package available (https://www.nuget.org/packages/PgBackup.Net/1.0.0) + ``` Install-Package PgBackup.Net -Version 1.0.0 ``` + dotnet cli: + ``` dotnet add package PgBackup.Net --version=1.0.0 ``` + # Package usage + ## 1. Register the service in Startup.cs or Program.cs file + ``` services.AddPgBackupServices(); ``` -## 2. call the BackupDB method with path string(the storage location of the backup tar file) + +## 2. call the BackupDB method with path string(the storage location of the backup tar file) + ``` using PgBackup.Services; public class myClass { private readonly IPgDumpService _pgDumpService; - + public myClass(IPgDumpService pgDumpService) { _pgDumpService = pgDumpService;