From 709f458aa7009106315406e958888f8c410e1a7c Mon Sep 17 00:00:00 2001 From: demirjs <41634504+hsndmr@users.noreply.github.com> Date: Mon, 8 Jul 2024 01:18:46 +0300 Subject: [PATCH] feat: Add GitHub Actions workflow for publishing Mailgen package. --- .github/workflows/publish.yml | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..89dcfae --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,64 @@ +name: Publish Mailgen Package + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + dotnet-version: [6.0.x, 8.0.x] + include: + - dotnet-version: 6.0.x + - dotnet-version: 8.0.x + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + - name: Install dependencies + run: dotnet restore Mailgen/Mailgen.csproj + + - name: Build + run: dotnet build Mailgen/Mailgen.csproj --configuration Release --no-restore + + - name: Test + run: dotnet test Mailgen/Mailgen.csproj --no-restore --verbosity normal + + publish: + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + + - name: Install dependencies + run: dotnet restore Mailgen/Mailgen.csproj + + - name: Build + run: dotnet build Mailgen/Mailgen.csproj --configuration Release --no-restore + + - name: Pack + run: dotnet pack Mailgen/Mailgen.csproj --configuration Release --no-restore --output nupkg + + - name: Publish to NuGet + run: dotnet nuget push nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json \ No newline at end of file