Skip to content

Commit

Permalink
Always archive release nuget packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jozefizso committed Jun 19, 2024
1 parent 6973677 commit 028615c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 39 deletions.
60 changes: 22 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ on:
- 'v*.*.*'

permissions:
id-token: write
contents: read

jobs:
release:
environment: production

runs-on: windows-2022

strategy:
matrix:
configuration: [Debug, Release]
configuration: [Release]

env:
DOTNET_NOLOGO: 1
Expand All @@ -25,6 +28,7 @@ jobs:
RepositoryBranch: '${{ github.ref_name }}'
RepositoryCommit: '${{ github.sha }}'
Configuration: '${{ matrix.configuration }}'
BUILD_SIGN_RELEASE: ${{ vars.BUILD_SIGN_RELEASE }}

steps:
- name: Checkout
Expand All @@ -45,14 +49,6 @@ jobs:
path: ~/.dotnet/tools
key: dotnettools

- name: Setup AzureSignTool
if: steps.cache-dotnettools.outputs.cache-hit != 'true'
run: dotnet tool install --verbosity minimal --global azuresigntool --version 5.0.0s

- name: Setup NuGetKeyVaultSignTool
if: steps.cache-dotnettools.outputs.cache-hit != 'true'
run: dotnet tool install --verbosity minimal --global NuGetKeyVaultSignTool --version 3.2.3

- name: Cache packages
uses: actions/cache@v4
with:
Expand All @@ -65,32 +61,19 @@ jobs:
id: build
run: .\.github\Get-BuildInfo.ps1 -ref '${{ github.ref }}' -event_name '${{ github.event_name }}' -configuration '${{ matrix.configuration }}'

- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.TRUSTED_SIGNING_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Build NetOffice
run: |
dotnet build Source\NetOffice.sln
env:
VersionSuffix: ${{ steps.build.outputs.app_version_suffix }}

- name: Sign Files Catalog
run: |
$content = Get-Content obj/signlist.txt
$content = $content.Replace('${{ github.workspace }}', '..')
$content | Set-Content obj/signlist.txt
- name: Sign NetOffice libraries
if: success() && steps.build.outputs.sign_binaries == 'true'
uses: azure/[email protected]
with:
azure-tenant-id: ${{ secrets.KEYVAULT_TENANT_ID }}
azure-client-id: ${{ secrets.KEYVAULT_CLIENT_ID }}
azure-client-secret: ${{ secrets.KEYVAULT_CLIENT_SECRET }}
endpoint: ${{ vars.KEYVAULT_ENDPOINT }}
trusted-signing-account-name: ${{ vars.KEYVAULT_ACCOUNT_NAME }}
certificate-profile-name: ${{ secrets.KEYVAULT_CERTIFICATE_PROFILE }}
files-catalog: '${{ github.workspace }}/obj/signlist.txt'
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
SignOutput: ${{ steps.build.outputs.sign_binaries }}

- name: Archive NetOffice binaries
uses: actions/upload-artifact@v4
Expand All @@ -99,6 +82,7 @@ jobs:
path: '${{ github.workspace }}\Source\ClientApplication\bin\${{ matrix.configuration }}'

- name: Pack NetOffice
id: packages
if: steps.build.outputs.publish_nuget == 'true'
run: |
dotnet pack --no-build --no-restore Source\NetOffice.sln -c ${{ matrix.configuration }} -o dist
Expand All @@ -119,17 +103,17 @@ jobs:
# --azure-key-vault-client-secret "${{ secrets.KEYVAULT_CLIENT_SECRET }}" `
# --azure-key-vault-certificate "goITSolutions-until-2024-01"

- name: Archive NetOffice packages
if: steps.packages.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: NetOffice_packages_v${{ steps.build.outputs.app_version_full }}
path: '${{ github.workspace }}\dist'

- name: Publish packages
if: success() && steps.build.outputs.publish_nuget == 'true'
if: steps.packages.outcome == 'success'
working-directory: '${{ github.workspace}}\dist'
run: |
dotnet nuget push *.nupkg --api-key $env:NUGET_TOKEN --source https://api.nuget.org/v3/index.json
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

- name: Archive NetOffice packages
if: success() && steps.build.outputs.publish_nuget == 'true'
uses: actions/upload-artifact@v4
with:
name: NetOffice_packages_v${{ steps.build.outputs.app_version_full }}
path: '${{ github.workspace }}\dist'
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.201'
dotnet-version: 8

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
Expand Down
1 change: 1 addition & 0 deletions Source/NetOffice.props
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

<!-- Authenticode signing -->
<PropertyGroup>
<SignOutput Condition=" '$(SignOutput)' == '' ">false</SignOutput>
<SignTimestampServer>http://timestamp.acs.microsoft.com/</SignTimestampServer>
<TrustedSigningConfigPath>$(MSBuildThisFileDirectory)trustedsigning.json</TrustedSigningConfigPath>
</PropertyGroup>
Expand Down

0 comments on commit 028615c

Please sign in to comment.