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