@@ -129,7 +129,7 @@ jobs:
129129 assembly-version : ${{ env.assembly-version }}
130130 assembly-informational-version : ${{ env.assembly-informational-version }}
131131 file-version : ${{ env.file-version }}
132- treat-warnins -as-error : ${{ needs.workflow-variables.outputs.is-release }}
132+ treat-warnings -as-error : ${{ needs.workflow-variables.outputs.is-release }}
133133
134134 test :
135135 name : ' Run tests'
@@ -169,6 +169,71 @@ jobs:
169169 - name : Write code coverage report summary
170170 run : cat ${{ steps.code-coverage-report.outputs.code-coverage-report-file }} >> $GITHUB_STEP_SUMMARY
171171
172+ update-api-unshipped :
173+ name : ' Update PublicAPI.Unshipped.txt'
174+ needs : [workflow-variables, build, validate-release]
175+ if : ${{ needs.workflow-variables.outputs.is-preview == 'true' }}
176+ runs-on : ubuntu-latest
177+ steps :
178+ - name : ' Checkout ${{ github.ref }}'
179+ uses : actions/checkout@v6
180+
181+ - name : ' Setup .NET'
182+ uses : actions/setup-dotnet@v5
183+ with :
184+ dotnet-version : ${{ env.dotnet-sdk-version }}
185+
186+ - name : ' Add missing API declarations to PublicAPI.Unshipped.txt'
187+ shell : bash
188+ run : dotnet format analyzers src/PolylineAlgorithm/PolylineAlgorithm.csproj --diagnostics RS0016
189+
190+ - name : ' Configure git identity'
191+ uses : ' ./.github/actions/git/configure-identity'
192+
193+ - name : ' Commit and push updated API files'
194+ shell : bash
195+ run : |
196+ git add src/PolylineAlgorithm/PublicAPI.Unshipped.txt
197+ git diff --staged --quiet || (
198+ git commit -m "Update PublicAPI.Unshipped.txt with new API declarations" &&
199+ git pull --rebase origin ${{ github.ref_name }} &&
200+ git push
201+ )
202+
203+ promote-api-files :
204+ name : ' Promote PublicAPI files (Unshipped -> Shipped)'
205+ needs : [workflow-variables, test, validate-release]
206+ if : ${{ needs.workflow-variables.outputs.is-release == 'true' }}
207+ runs-on : ubuntu-latest
208+ steps :
209+ - name : ' Checkout ${{ github.ref }}'
210+ uses : actions/checkout@v6
211+
212+ - name : ' Promote Unshipped.txt into Shipped.txt'
213+ shell : bash
214+ run : |
215+ UNSHIPPED="src/PolylineAlgorithm/PublicAPI.Unshipped.txt"
216+ SHIPPED="src/PolylineAlgorithm/PublicAPI.Shipped.txt"
217+
218+ # Append every non-blank, non-header line from Unshipped into Shipped
219+ tail -n +2 "$UNSHIPPED" | grep -v '^[[:space:]]*$' >> "$SHIPPED" || true
220+
221+ # Reset Unshipped to just the nullable-enable header (with BOM to match convention)
222+ printf '\xef\xbb\xbf#nullable enable\n' > "$UNSHIPPED"
223+
224+ - name : ' Configure git identity'
225+ uses : ' ./.github/actions/git/configure-identity'
226+
227+ - name : ' Commit and push promoted API files'
228+ shell : bash
229+ run : |
230+ git add src/PolylineAlgorithm/PublicAPI.Shipped.txt src/PolylineAlgorithm/PublicAPI.Unshipped.txt
231+ git diff --staged --quiet || (
232+ git commit -m "Promote PublicAPI.Unshipped.txt into PublicAPI.Shipped.txt for release" &&
233+ git pull --rebase origin ${{ github.ref_name }} &&
234+ git push
235+ )
236+
172237 pack :
173238 name : ' Package binaries'
174239 needs : [versioning, build, test, validate-release]
@@ -219,8 +284,14 @@ jobs:
219284
220285 publish-package :
221286 name : ' Publish package'
222- needs : [pack, validate-release, publish-documentation]
223- if : ${{ always() && needs.pack.result == 'success' && needs.validate-release.result == 'success' && (needs.publish-documentation.result == 'success' || needs.publish-documentation.result == 'skipped') }}
287+ needs : [pack, validate-release, publish-documentation, update-api-unshipped, promote-api-files]
288+ if : |
289+ always() &&
290+ needs.pack.result == 'success' &&
291+ needs.validate-release.result == 'success' &&
292+ (needs.publish-documentation.result == 'success' || needs.publish-documentation.result == 'skipped') &&
293+ (needs.promote-api-files.result == 'success' || needs.promote-api-files.result == 'skipped') &&
294+ (needs.update-api-unshipped.result == 'success' || needs.update-api-unshipped.result == 'skipped')
224295 env :
225296 package-artifact-name : ${{ needs.pack.outputs.package-artifact-name }}
226297 runs-on : ubuntu-latest
0 commit comments