Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
build:

Expand All @@ -30,6 +33,41 @@ jobs:
- name: Test
timeout-minutes: 2
run: dotnet test --no-build
- name: Pack NuGet packages (PR validation)
if: matrix.dotnet-version == '8.0.x'
run: |
dotnet pack Activout.RestClient/Activout.RestClient.csproj \
-p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source
dotnet pack Activout.RestClient.Json/Activout.RestClient.Json.csproj \
-p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source
dotnet pack Activout.RestClient.Newtonsoft.Json/Activout.RestClient.Newtonsoft.Json.csproj \
-p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source
dotnet pack Activout.RestClient.Xml/Activout.RestClient.Xml.csproj \
-p:PackageVersion=1.0.0-pr${{ github.event.pull_request.number }}.${{ github.run_number }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source
- name: Upload NuGet packages
if: matrix.dotnet-version == '8.0.x'
uses: actions/upload-artifact@v4
with:
name: nuget-packages-pr${{ github.event.pull_request.number }}-run${{ github.run_number }}
path: |
**/*.nupkg
**/*.snupkg
# - name: Archive test results
# uses: actions/upload-artifact@v4
# if: always()
Expand Down
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Release

on:
release:
types: [created]

permissions:
contents: write

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Extract version from tag
id: get_version
run: |
# Remove 'v' prefix if present (e.g., v1.2.3 -> 1.2.3)
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration=Release --no-restore

- name: Test
timeout-minutes: 2
run: dotnet test --configuration=Release --no-build

- name: Pack Activout.RestClient
run: |
dotnet pack Activout.RestClient/Activout.RestClient.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs

- name: Pack Activout.RestClient.Json
run: |
dotnet pack Activout.RestClient.Json/Activout.RestClient.Json.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs

- name: Pack Activout.RestClient.Newtonsoft.Json
run: |
dotnet pack Activout.RestClient.Newtonsoft.Json/Activout.RestClient.Newtonsoft.Json.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs

- name: Pack Activout.RestClient.Xml
run: |
dotnet pack Activout.RestClient.Xml/Activout.RestClient.Xml.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs

- name: List generated packages
run: ls -lh ./nupkgs/

- name: Upload packages to release
uses: softprops/action-gh-release@v2
with:
files: ./nupkgs/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Uncomment to publish to NuGet.org
# - name: Push to NuGet.org
# run: |
# dotnet nuget push ./nupkgs/*.nupkg \
# --api-key ${{ secrets.NUGET_API_KEY }} \
# --source https://api.nuget.org/v3/index.json \
# --skip-duplicate
Loading