|
29 | 29 | RepositoryCommit: '${{ github.sha }}' |
30 | 30 | Configuration: '${{ matrix.configuration }}' |
31 | 31 |
|
| 32 | + outputs: |
| 33 | + nuget_packages_artifact_name: ${{ steps.build.outputs.nuget_packages_artifact_name }} |
| 34 | + |
32 | 35 | steps: |
33 | 36 | - name: Checkout |
34 | 37 | uses: actions/checkout@v5 |
@@ -147,17 +150,52 @@ jobs: |
147 | 150 | $nupkg = Get-ChildItem -Path '${{ github.workspace}}\dist' -Filter '*.nupkg' | Select-Object -First 1 |
148 | 151 | nuget-cert-extractor --file $nupkg --output '${{ github.workspace}}\dist' --code-signing --author --leaf |
149 | 152 |
|
150 | | - - name: Publish packages |
151 | | - if: success() && steps.build.outputs.publish_nuget == 'true' |
152 | | - working-directory: '${{ github.workspace}}\dist' |
153 | | - run: | |
154 | | - dotnet nuget push *.nupkg --api-key $env:NUGET_TOKEN --source https://api.nuget.org/v3/index.json |
155 | | - env: |
156 | | - NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} |
157 | | - |
158 | 153 | - name: Archive NetOffice packages |
159 | 154 | if: success() |
160 | 155 | uses: actions/upload-artifact@v5 |
161 | 156 | with: |
162 | | - name: NetOffice_packages_v${{ steps.build.outputs.app_version_full }} |
| 157 | + name: ${{ steps.build.outputs.nuget_packages_artifact_name }} |
163 | 158 | path: '${{ github.workspace }}\dist' |
| 159 | + |
| 160 | + - name: Archive code signing certificate |
| 161 | + if: success() && matrix.configuration == 'Release' |
| 162 | + uses: actions/upload-artifact@v5 |
| 163 | + with: |
| 164 | + name: certificate |
| 165 | + path: '${{ github.workspace }}/dist/*.cer' |
| 166 | + |
| 167 | + - name: Release documentation |
| 168 | + if: matrix.configuration == 'Release' |
| 169 | + run: | |
| 170 | + 'To release the NuGet package, upload the signing certificate to NuGet Gallery via Account Settings: <https://www.nuget.org/account>. ' >> $env:GITHUB_STEP_SUMMARY |
| 171 | + 'See the `certificate` artifact for the signing certificate file.' >> $env:GITHUB_STEP_SUMMARY |
| 172 | + '' >> $env:GITHUB_STEP_SUMMARY |
| 173 | + 'Approve the `publish` job deployment to the `nuget-gallery` environment when the certificate was added to NuGet Gallery.' >> $env:GITHUB_STEP_SUMMARY |
| 174 | +
|
| 175 | + publish: |
| 176 | + environment: nuget-gallery |
| 177 | + |
| 178 | + permissions: |
| 179 | + id-token: write |
| 180 | + |
| 181 | + needs: release |
| 182 | + |
| 183 | + runs-on: ubuntu-latest |
| 184 | + |
| 185 | + steps: |
| 186 | + - name: Download NetOffice packages |
| 187 | + uses: actions/download-artifact@v5 |
| 188 | + with: |
| 189 | + name: ${{ needs.release.outputs.nuget_packages_artifact_name }} |
| 190 | + |
| 191 | + - name: Authenticate Nuget Gallery |
| 192 | + uses: NuGet/login@v1 |
| 193 | + id: nuget |
| 194 | + with: |
| 195 | + user: ${{ secrets.NUGET_TRUSTED_PUBLISHING_USER }} |
| 196 | + |
| 197 | + - name: Publish packages |
| 198 | + run: | |
| 199 | + dotnet nuget push "*.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json |
| 200 | + env: |
| 201 | + NUGET_API_KEY: ${{ steps.nuget.outputs.NUGET_API_KEY }} |
0 commit comments