forked from dotnet/docfx
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (100 loc) · 3.74 KB
/
release.yml
File metadata and controls
119 lines (100 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/build
- name: dotnet pack
run: dotnet pack -c Release /p:Version=${GITHUB_REF_NAME#v} -o drop/nuget
- name: dotnet publish
run: |
dotnet publish src/docfx -f net10.0 -c Release /p:Version=${GITHUB_REF_NAME#v} --self-contained -r win-x64 -o drop/publish/win-x64
dotnet publish src/docfx -f net10.0 -c Release /p:Version=${GITHUB_REF_NAME#v} --self-contained -r linux-x64 -o drop/publish/linux-x64
dotnet publish src/docfx -f net10.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@v6
with:
name: nuget
path: drop/nuget
- uses: actions/upload-artifact@v6
with:
name: bin
path: drop/bin
sign:
runs-on: windows-latest
needs: build
environment: nuget.org
permissions:
id-token: write
steps:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
- uses: actions/download-artifact@v7
with:
name: nuget
path: drop/nuget
# Install `Sign CLI` to use Azure Key Vault (See: https://github.com/dotnet/sign/blob/main/docs/comparisons.md)
- run: dotnet tool install --tool-path . --prerelease sign
- uses: azure/login@v2
with:
allow-no-subscriptions: true
client-id: ${{ secrets.SIGN_KEY_VAULT_CLIENT_ID }}
tenant-id: ${{ secrets.SIGN_KEY_VAULT_TENANT_ID }}
- run: >
./sign code azure-key-vault
drop/nuget/**/*.*
--description "Docfx code sign"
--description-url "https://dotnet.github.io/docfx"
--timestamp-url http://timestamp.digicert.com
--azure-credential-type "azure-cli"
--azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}"
--azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE }}"
- uses: actions/upload-artifact@v6
with:
name: nuget-signed
path: drop/nuget
publish:
runs-on: ubuntu-latest
needs: sign
environment: nuget.org
permissions:
contents: write
id-token: write
steps:
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
- uses: actions/download-artifact@v7
with:
name: nuget-signed
path: drop/nuget
- uses: actions/download-artifact@v7
with:
name: bin
path: drop/bin
- name: NuGet login
uses: NuGet/login@v1
id: nuget-login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish NuGet packages
run: |
dotnet nuget push drop/nuget/*.nupkg --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" --skip-duplicate --source https://api.nuget.org/v3/index.json
- name: Upload GitHub release
run: |
gh release upload --repo dotnet/docfx ${GITHUB_REF_NAME} drop/bin/docfx-win-x64-${GITHUB_REF_NAME}.zip
gh release upload --repo dotnet/docfx ${GITHUB_REF_NAME} drop/bin/docfx-linux-x64-${GITHUB_REF_NAME}.zip
gh release upload --repo dotnet/docfx ${GITHUB_REF_NAME} drop/bin/docfx-osx-x64-${GITHUB_REF_NAME}.zip
env:
GH_TOKEN: ${{ github.token }}