-
Notifications
You must be signed in to change notification settings - Fork 8
123 lines (109 loc) · 3.88 KB
/
publish.yaml
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
120
121
122
123
name: 'Publish packages'
on:
workflow_dispatch:
inputs:
deploy-sdk:
type: boolean
description: Deploy components of the SDK (Compiler, Toolset, Sdk, ProjectTemplates)
deploy-repl:
type: boolean
description: Deploy components of the REPL (Compiler, Repl)
deploy-langserver:
type: boolean
description: Deploy the language server (Compiler, LanguageServer, Lsp)
deploy-debugadapter:
type: boolean
description: Deploy the debug adapter (DebugAdapter, Dap)
deploy-vscext:
type: boolean
description: Deploy the VS Code extension
version:
type: string
description: The version number to deploy with
required: true
prerelease:
type: boolean
description: The deployed version is pre-release
env:
DOTNET_VERSION: '8.0.x' # The .NET SDK version to use
CONFIGURATION: 'Release' # The configuration to use
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
VSC_MARKETPLACE_TOKEN: ${{ secrets.VSC_MARKETPLACE_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
PRERELEASE: ${{ github.event.inputs.prerelease }}
jobs:
deploy:
runs-on: windows-latest
steps:
# Set up environment
- name: Clone the repo
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 18
- name: Install VSCE
run: npm install -g @vscode/vsce
# Build and packaging
- name: Package .NET portion
run: |
cd src
$sdkProjects = "Compiler", "Compiler.Toolset", "Sdk", "ProjectTemplates"
$replProjects = "Compiler", "Repl"
$langserverProjects = "Compiler", "LanguageServer", "Lsp", "JsonRpc"
$debugadapterProjects = "DebugAdapter", "Dap", "JsonRpc"
$projects = @()
if ($${{ github.event.inputs.deploy-sdk }}) { $projects += $sdkProjects; }
if ($${{ github.event.inputs.deploy-repl }}) { $projects += $replProjects; }
if ($${{ github.event.inputs.deploy-langserver }}) { $projects += $langserverProjects; }
if ($${{ github.event.inputs.deploy-debugadapter }}) { $projects += $debugadapterProjects; }
$version = "${{ env.VERSION }}"
if ($${{ env.PRERELEASE }}) { $version = "$version-pre"; }
foreach ($project in $projects)
{
$project = "Draco.$project"
dotnet pack $project --configuration ${{ env.CONFIGURATION }} /p:Version="$version"
}
cd ..
- name: Package VS Code extension
run: |
cd src/Draco.Extension.VsCode
if ($${{ github.event.inputs.deploy-vscext }})
{
Copy-Item "../../LICENSE" -Destination "LICENSE"
npm install
npm version "${{ env.VERSION }}"
if ($${{ env.PRERELEASE }}) { npm pkg set preview=true --json }
vsce package
}
cd ../..
# Publishing
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: |
src/**/*.nupkg
src/**/*.vsix
- name: Upload to NuGet.org
run: |
cd src
$packages = Get-ChildItem -Recurse | Where { $_.Name -like "*.nupkg" -and $_.Name -notlike "*symbols*" }
foreach ($package in $packages)
{
dotnet nuget push $package.FullName --api-key ${{ env.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate
}
cd ..
- name: Upload to VS Code Marketplace
run: |
cd src/Draco.Extension.VsCode
if ($${{ github.event.inputs.deploy-vscext }})
{
vsce publish --pat ${{ env.VSC_MARKETPLACE_TOKEN }}
}
cd ../..