From eddc44c754999ab3a9d37d13e64b444641e7d1cd Mon Sep 17 00:00:00 2001 From: Yufei Huang Date: Wed, 12 Jul 2023 20:17:57 +0800 Subject: [PATCH] fix: fix release process --- .github/workflows/release.yml | 92 +++++++++++++++++++++++------------ Directory.Build.props | 4 +- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67b5eace1be..3016ffd4dff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,11 @@ name: release on: release: - types: [published] + types: [published, edited] jobs: - release: + build: runs-on: ubuntu-latest - permissions: - contents: write steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -39,6 +37,41 @@ jobs: dotnet publish src/docfx -f net7.0 -c Release /p:Version=${GITHUB_REF_NAME#v} --self-contained -r osx-x64 -o drop/publish/osx-x64 mkdir -p drop/bin + - run: zip -r ../../bin/docfx-win-x64-${GITHUB_REF_NAME}.zip . + working-directory: drop/publish/win-x64 + - run: zip -r ../../bin/docfx-linux-x64-${GITHUB_REF_NAME}.zip . + working-directory: drop/publish/linux-x64 + - run: zip -r ../../bin/docfx-osx-x64-${GITHUB_REF_NAME}.zip . + working-directory: drop/publish/osx-x64 + + - uses: actions/upload-artifact@v3 + with: + name: nuget + path: drop/nuget + + - uses: actions/upload-artifact@v3 + with: + name: publish + path: drop/publish + + sign: + runs-on: windows-latest + needs: build + steps: + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.x + + - uses: actions/download-artifact@v3 + with: + name: nuget + path: drop/nuget + + - uses: actions/download-artifact@v3 + with: + name: publish + path: drop/publish + - run: dotnet tool install --tool-path . sign --version 0.9.1-beta.23274.1 - run: > @@ -46,41 +79,41 @@ jobs: drop/nuget/**/*.* --description "Docfx code sign" --description-url "https://dotnet.github.io/docfx" - --azure-key-vault-managed-identity true --azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}" --azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE }}" --azure-key-vault-tenant-id "${{ secrets.SIGN_KEY_VAULT_TENANT_ID }}" --azure-key-vault-client-id "${{ secrets.SIGN_KEY_VAULT_CLIENT_ID }}" --azure-key-vault-client-secret "${{ secrets.SIGN_KEY_VAULT_CLIENT_SECRET }}" - - run: > - ./sign code azure-key-vault - bin/**/*.* - --description "Docfx code sign" - --description-url "https://dotnet.github.io/docfx" - --azure-key-vault-managed-identity true - --azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}" - --azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE }}" - --azure-key-vault-tenant-id "${{ secrets.SIGN_KEY_VAULT_TENANT_ID }}" - --azure-key-vault-client-id "${{ secrets.SIGN_KEY_VAULT_CLIENT_ID }}" - --azure-key-vault-client-secret "${{ secrets.SIGN_KEY_VAULT_CLIENT_SECRET }}" + - uses: actions/upload-artifact@v3 + with: + name: nuget-signed + path: drop/nuget - - run: zip -r ../../bin/docfx-win-x64-${GITHUB_REF_NAME}.zip . - working-directory: drop/publish/win-x64 - - run: zip -r ../../bin/docfx-linux-x64-${GITHUB_REF_NAME}.zip . - working-directory: drop/publish/linux-x64 - - run: zip -r ../../bin/docfx-osx-x64-${GITHUB_REF_NAME}.zip . - working-directory: drop/publish/osx-x64 + publish: + runs-on: ubuntu-latest + needs: sign + permissions: + contents: write + steps: + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.x - - uses: actions/upload-artifact@v3 + - uses: actions/download-artifact@v3 with: - name: nuget + name: nuget-signed path: drop/nuget - - uses: actions/upload-artifact@v3 + - uses: actions/download-artifact@v3 with: - name: bin - path: drop/bin + name: publish + path: drop/publish + + - run: | + dotnet nuget push $(Pipeline.Workspace)\nuget\*.nupkg --api-key $env:NUGET_KEY --skip-duplicate --source https://nuget.org + env: + NUGET_KEY: $(NUGET_KEY) - name: Upload GitHub release run: | @@ -89,8 +122,3 @@ jobs: gh release upload ${GITHUB_REF_NAME} drop/bin/docfx-osx-x64-${GITHUB_REF_NAME}.zip env: GH_TOKEN: ${{ github.token }} - - - run: | - dotnet nuget push $(Pipeline.Workspace)\nuget\*.nupkg --api-key $env:NUGET_KEY --skip-duplicate --source https://nuget.org - env: - NUGET_KEY: $(NUGET_KEY) diff --git a/Directory.Build.props b/Directory.Build.props index 241af2b22c1..e5001fcf1e1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,9 +25,9 @@ snupkg true - Microsoft - Microsoft + .NET Foundation and Contributors Copyright (c) .NET Foundation and Contributors + Technical documentation tool with markdown, API docs for .NET, REST API and more. README.md https://github.com/dotnet/docfx