|
1 | | -name: Publish RestClient.Net to NuGet |
| 1 | +name: Release RestClient.Net and Exhaustion |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
7 | 7 | workflow_dispatch: |
8 | 8 | inputs: |
9 | 9 | version: |
10 | | - description: 'Version number (e.g., 6.0.0)' |
| 10 | + description: 'RestClient.Net version (e.g., 7.3.1); ExhaustionVersion comes from Directory.Build.props' |
11 | 11 | required: true |
12 | 12 | type: string |
13 | 13 |
|
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: nuget-release-${{ github.repository }} |
| 19 | + cancel-in-progress: false |
| 20 | + |
14 | 21 | jobs: |
15 | 22 | publish: |
16 | 23 | runs-on: ubuntu-latest |
| 24 | + timeout-minutes: 30 |
| 25 | + env: |
| 26 | + DOTNET_PROCESSOR_COUNT: '2' |
17 | 27 |
|
18 | 28 | steps: |
19 | | - - name: Checkout code |
| 29 | + - name: Checkout release source |
20 | 30 | uses: actions/checkout@v4 |
21 | 31 |
|
| 32 | + - name: Isolate NuGet cache |
| 33 | + run: echo "NUGET_PACKAGES=$RUNNER_TEMP/release-nuget" >> "$GITHUB_ENV" |
| 34 | + |
| 35 | + - name: Resolve and validate release versions |
| 36 | + id: versions |
| 37 | + env: |
| 38 | + REQUESTED_VERSION: ${{ inputs.version || github.ref_name }} |
| 39 | + run: python3 scripts/release.py versions --client-version "$REQUESTED_VERSION" >> "$GITHUB_OUTPUT" |
| 40 | + |
22 | 41 | - name: Setup .NET |
23 | 42 | uses: actions/setup-dotnet@v4 |
24 | 43 | with: |
25 | | - dotnet-version: '8.0.x' |
| 44 | + dotnet-version: | |
| 45 | + 8.0.x |
| 46 | + 9.0.x |
26 | 47 |
|
27 | | - - name: Restore dependencies |
28 | | - run: dotnet restore RestClient.Net/RestClient.Net.csproj |
| 48 | + - name: Test release ordering and artifact verification |
| 49 | + run: python3 -m unittest discover -s scripts/tests -p test_release_orchestration.py -v |
29 | 50 |
|
30 | | - - name: Build |
31 | | - run: dotnet build RestClient.Net/RestClient.Net.csproj --configuration Release --no-restore |
| 51 | + - name: Build both release packages from this commit |
| 52 | + env: |
| 53 | + CLIENT_VERSION: ${{ steps.versions.outputs.client_version }} |
| 54 | + ANALYZER_VERSION: ${{ steps.versions.outputs.analyzer_version }} |
| 55 | + run: python3 scripts/release.py pack --client-version "$CLIENT_VERSION" --analyzer-version "$ANALYZER_VERSION" --output .artifacts/release |
32 | 56 |
|
33 | | - - name: Set version from tag |
34 | | - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
35 | | - run: | |
36 | | - VERSION=${GITHUB_REF#refs/tags/restclient-v} |
37 | | - echo "REST_CLIENT_DOTNET_VERSION=$VERSION" >> $GITHUB_ENV |
| 57 | + - name: Run analyzer regressions |
| 58 | + run: dotnet test Exhaustion.Tests/Exhaustion.Tests.csproj --configuration Release --verbosity normal |
38 | 59 |
|
39 | | - - name: Set version from input |
40 | | - if: github.event_name == 'workflow_dispatch' |
| 60 | + - name: Verify actual packages in isolated consumers |
| 61 | + env: |
| 62 | + CLIENT_VERSION: ${{ steps.versions.outputs.client_version }} |
| 63 | + ANALYZER_VERSION: ${{ steps.versions.outputs.analyzer_version }} |
41 | 64 | run: | |
42 | | - echo "REST_CLIENT_DOTNET_VERSION=${{ vars.REST_CLIENT_DOTNET_VERSION }}" >> $GITHUB_ENV |
| 65 | + for framework in net8.0 net9.0; do |
| 66 | + python3 scripts/tests/test_release_packages.py --packages .artifacts/release --restclient-version "$CLIENT_VERSION" --exhaustion-version "$ANALYZER_VERSION" --framework "$framework" |
| 67 | + done |
43 | 68 |
|
44 | | - - name: Pack |
45 | | - run: dotnet pack RestClient.Net/RestClient.Net.csproj --configuration Release --no-build --output ./packages /p:Version=${{ env.REST_CLIENT_DOTNET_VERSION }} |
| 69 | + - name: Upload verified release packages |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: restclient-and-exhaustion-packages |
| 73 | + path: | |
| 74 | + .artifacts/release/*.nupkg |
| 75 | + .artifacts/release/*.snupkg |
| 76 | + if-no-files-found: error |
46 | 77 |
|
47 | | - - name: Publish to NuGet |
48 | | - run: dotnet nuget push ./packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |
| 78 | + - name: Publish and verify Exhaustion before RestClient.Net |
49 | 79 | env: |
50 | 80 | NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |
| 81 | + CLIENT_VERSION: ${{ steps.versions.outputs.client_version }} |
| 82 | + ANALYZER_VERSION: ${{ steps.versions.outputs.analyzer_version }} |
| 83 | + run: python3 scripts/release.py publish --client-version "$CLIENT_VERSION" --analyzer-version "$ANALYZER_VERSION" --output .artifacts/release |
51 | 84 |
|
52 | | - - name: Upload package artifact |
53 | | - uses: actions/upload-artifact@v4 |
54 | | - with: |
55 | | - name: restclient-nuget-package |
56 | | - path: ./packages/*.nupkg |
| 85 | + - name: Verify published packages from NuGet in fresh consumers |
| 86 | + env: |
| 87 | + CLIENT_VERSION: ${{ steps.versions.outputs.client_version }} |
| 88 | + ANALYZER_VERSION: ${{ steps.versions.outputs.analyzer_version }} |
| 89 | + run: | |
| 90 | + for framework in net8.0 net9.0; do |
| 91 | + python3 scripts/tests/test_release_packages.py --public-nuget --restclient-version "$CLIENT_VERSION" --exhaustion-version "$ANALYZER_VERSION" --framework "$framework" |
| 92 | + done |
0 commit comments