-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
56 lines (48 loc) · 1.77 KB
/
action.yml
File metadata and controls
56 lines (48 loc) · 1.77 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
# Copyright 2025 Braden Ganetsky
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
name: 'Setup MSVC'
description: 'Downloads, installs, and sets up the environment for a particular version of MSVC'
author: 'Braden Ganetsky'
inputs:
vs-version:
required: true
install-path:
default: ..\vs-install
runs:
using: "composite"
steps:
- name: Download and install VS Build Tools, and setup MSVC environment
shell: powershell
run: |
mkdir ${{ inputs.install-path }} -Force
$installPath = Resolve-Path ${{ inputs.install-path }}
$scriptOutput = python ${{ github.action_path }}/get_install_args.py ${{ inputs.vs-version }} 2>&1
if ($LASTEXITCODE -eq 0) {
$vsVersion = $scriptOutput[0]
$bootstrapper = $scriptOutput[1]
$componentID = $scriptOutput[2]
Write-Host "Installing Visual Studio $vsVersion at $installPath"
} else {
Write-Host "get_install_args.py failed with exit code: $LASTEXITCODE"
Write-Host $scriptOutput
exit $LASTEXITCODE
}
Invoke-Webrequest -Uri $bootstrapper -OutFile vs_buildtools.exe
Start-Process `
-FilePath ".\vs_buildtools.exe" `
-ArgumentList @(
'--quiet', '--norestart',
'--installPath', $installPath,
'--add', $componentID,
'--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
'--includeRecommended',
'--noUpdateInstaller'
) `
-NoNewWindow `
-Wait
rm .\vs_buildtools.exe
cmd /c "$installPath\VC\Auxiliary\Build\vcvars64.bat >nul && set" |
ForEach-Object {
Add-Content $env:GITHUB_ENV $_
}