Skip to content

Commit

Permalink
fix: fix release process
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih committed Jul 12, 2023
1 parent ab29f53 commit eddc44c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 34 deletions.
92 changes: 60 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -39,48 +37,83 @@ 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: >
./sign code azure-key-vault
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: |
Expand All @@ -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)
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<Authors>Microsoft</Authors>
<Company>Microsoft</Company>
<Authors>.NET Foundation and Contributors</Authors>
<Copyright>Copyright (c) .NET Foundation and Contributors</Copyright>
<Description>Technical documentation tool with markdown, API docs for .NET, REST API and more.</Description>

<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/dotnet/docfx</PackageProjectUrl>
Expand Down

0 comments on commit eddc44c

Please sign in to comment.