Compare commits

...

95 Commits

Author SHA1 Message Date
6fb0222098 Address issue #125 releasing the node20 action as major version change 2024-01-30 17:01:17 -08:00
ede762b26a Reverting to node16 for compat in 1.x versions 2024-01-30 16:51:49 -08:00
031090342a Updated lock 2024-01-25 19:02:21 -08:00
79fdc4b9cf Version bump 2024-01-25 18:54:32 -08:00
56275591f5 Merge branch 'kawon7317-main' 2024-01-25 18:53:59 -08:00
faa06544ad Update action.yml
Replace Node.js 16 with Node.js 20
2024-01-25 17:39:12 +08:00
c9685f2ae5 Merge pull request #122 from mosfet80/patch-1 [skip ci]
Update test.yml
2024-01-16 12:01:13 -08:00
f37d07ecbd Update test.yml
updated  actions/checkout to v4
2024-01-16 01:01:19 +01:00
3404ff3d40 Adding runner image doc note [skip ci] 2023-08-14 08:38:37 -07:00
1ff57057b5 Added action-types 2023-02-03 15:02:07 -08:00
0e7c76c8f5 Merge pull request #110 from Vampire/issue-109 [skip ci]
Implement #109 adding action types file and fixes #111 as well
2023-02-03 08:46:55 -08:00
3ac564e2a5 Implement #109 adding action types file 2023-02-03 17:43:05 +01:00
d3ea839497 Version bump 2022-12-13 08:12:09 -08:00
0a09b7fae9 Fixes #104 reassigning input arg [skip ci] 2022-12-13 08:07:05 -08:00
0b93bd95fc Adding arm64 sniffing support 2022-12-12 12:36:10 -08:00
cc48120b57 Merge branch 'master' into arm64 2022-11-13 08:08:00 -07:00
645e3f7313 Modifying version and readme notes [skip ci] 2022-11-13 08:01:59 -07:00
1ccd12233c Fixing formatting on string arg [skip ci] 2022-11-07 17:16:50 -07:00
750ad4a08c Dedupe IDs [skip ci] 2022-11-07 17:13:28 -07:00
8c3da926c2 Dedupe IDs [skip ci] 2022-11-07 17:05:30 -07:00
e0b9f539d1 Adding arm64 tester [skip ci] 2022-11-07 17:03:36 -07:00
e38c2fa359 modifying tester [skip ci] 2022-11-07 16:55:30 -07:00
1bba226ea3 Adding arm64 detection 2022-11-07 16:54:38 -07:00
0b44c6745b Merge pull request #94 from microsoft/v1.1.3
Fixes #93 [skip ci]
2022-10-12 16:19:33 -07:00
34cfbaee7f Fixes #93 2022-10-12 16:07:40 -07:00
a1c1eda384 Merge pull request #90 from microsoft/v1.1.2
V1.1.2
2022-10-11 16:17:00 -07:00
d6496d378f version bump 2022-10-11 16:11:40 -07:00
b381dbabab Pruned and packed 2022-10-11 15:59:42 -07:00
36d6f2fae1 Updating version 2022-10-11 15:56:19 -07:00
65aeb87ed1 Merge branch 'Morrisby-master' into v1.1.1 2022-10-11 15:54:09 -07:00
50f8578df5 Update to use Node.js 16 2022-10-11 21:58:04 +01:00
fbf0ccc42a Fixes #67 [skip ci] 2021-11-08 15:24:09 -07:00
fbf959e541 Merge branch 'MarkIngramUK-patch-1' 2021-11-08 15:17:17 -07:00
ce3de01b52 Updated README.md to include vs-prerelease and msbuild-architecture
Inspired by #67 I thought I would propose an update to the readme to cover the two missing inputs.
2021-11-08 22:02:23 +00:00
c7c2934c87 Fix #58 clarifying intent and providing example usage [skip ci] 2021-11-03 06:28:29 -07:00
c4a66a0e8a Updated docs [skip ci] 2021-11-01 20:07:20 -07:00
e48d8c6605 Merge branch 'baronfel-x64-probing' 2021-11-01 20:03:29 -07:00
ab534842b4 Merging x64 probe and typos 2021-11-01 20:01:10 -07:00
84e0d709b2 Update src/main.ts
Co-authored-by: Heath Stewart <heaths@outlook.com>
2021-11-01 18:58:32 -07:00
613696a2a0 Update action.yml
Co-authored-by: Heath Stewart <heaths@outlook.com>
2021-11-01 18:58:16 -07:00
6c2e301a93 add probing for x64 msbuild binaries 2021-11-01 16:58:33 -05:00
0cd944e169 Merge pull request #61 from microsoft/dependabot/npm_and_yarn/ws-5.2.3 [skip ci]
Bump ws from 5.2.2 to 5.2.3
2021-08-24 14:21:52 -06:00
aaa8d4fac0 Merge pull request #57 from microsoft/dependabot/npm_and_yarn/path-parse-1.0.7 [skip ci]
Bump path-parse from 1.0.6 to 1.0.7
2021-08-24 14:21:40 -06:00
323ede3ce9 Merge pull request #53 from microsoft/dependabot/npm_and_yarn/hosted-git-info-2.8.9 [skip ci]
Bump hosted-git-info from 2.8.5 to 2.8.9
2021-08-24 14:21:26 -06:00
dfaf113754 Merge pull request #52 from microsoft/dependabot/npm_and_yarn/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21
2021-08-24 14:21:11 -06:00
33941d8101 Merge pull request #51 from microsoft/dependabot/npm_and_yarn/handlebars-4.7.7
Bump handlebars from 4.5.3 to 4.7.7
2021-08-24 14:20:59 -06:00
8611b39e1b Merge pull request #46 from microsoft/dependabot/npm_and_yarn/y18n-4.0.1 [skip ci]
Bump y18n from 4.0.0 to 4.0.1
2021-08-24 14:20:46 -06:00
2cbcfcb795 Bump ws from 5.2.2 to 5.2.3
Bumps [ws](https://github.com/websockets/ws) from 5.2.2 to 5.2.3.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/5.2.2...5.2.3)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-24 20:00:17 +00:00
a7d39343f8 Merge pull request #60 from microsoft/v1.0.3 [skip ci]
Merging 1.0.3 changes
2021-08-24 13:59:39 -06:00
9546707e6b Fixing input warning message 2021-08-24 12:54:44 -07:00
f9e64ce582 Adding pre-release input flag 2021-08-24 12:51:38 -07:00
6387a9728e Merge branch 'Clancey-patch-1' 2021-08-24 12:45:51 -07:00
412f270368 Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-12 04:46:29 +00:00
455ec54ae7 Always use -latest 2021-07-13 14:36:17 -08:00
4917605713 Allows vs-prerelease option Fixes #45 2021-07-13 13:31:52 -08:00
7561732237 Added an option for allow-prerelease 2021-07-13 13:22:52 -08:00
047d9a0678 Bump hosted-git-info from 2.8.5 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.5 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.5...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 14:56:14 +00:00
9afe006fef Bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 08:06:47 +00:00
babd7930ed Bump handlebars from 4.5.3 to 4.7.7
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.5.3 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.5.3...v4.7.7)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-08 20:43:55 +00:00
7626c90a39 Bump y18n from 4.0.0 to 4.0.1
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-31 18:28:35 +00:00
1982f45c48 Update README.md
Clarifying more that this is only for MSBuild
2021-03-15 08:05:45 -07:00
0e477eda77 Adding doc on release process 2020-10-06 09:20:39 -07:00
f032e55f3f Update readme to latest version 2020-10-06 08:57:14 -07:00
6a8fedefe9 Merge pull request #25 from microsoft/dependabot/npm_and_yarn/actions/core-1.2.6
Bump @actions/core from 1.2.0 to 1.2.6
2020-10-06 08:28:29 -07:00
a0858ffef3 Bump @actions/core from 1.2.0 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.0 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 17:33:54 +00:00
9fe8dba406 Merge pull request #23 from LanceMcCarthy/patch-1
Update README.md
2020-09-01 13:49:32 -07:00
0b5643901b Update README.md
Fixed incorrect indentation of `with` in examples
2020-09-01 16:38:21 -04:00
45346b5e09 Merge pull request #21 from kishorejangid/patch-1
Update README.md
2020-08-03 08:10:44 -07:00
06c9a7f31c Update README.md
Incorrect grammar
2020-08-01 18:15:15 +05:30
f25dd68be2 Merge branch 'dependabot/npm_and_yarn/lodash-4.17.19' into dev 2020-07-22 21:15:24 -07:00
3fedb575b0 Merge branch 'dev' into dependabot/npm_and_yarn/lodash-4.17.19 2020-07-22 21:15:13 -07:00
84ff5b46d8 Merge branch 'dependabot/npm_and_yarn/actions/http-client-1.0.8' into dev 2020-07-22 21:14:53 -07:00
e4874c190b Merge branch 'dependabot/npm_and_yarn/acorn-5.7.4' into dev 2020-07-22 21:14:33 -07:00
41a4f5dd79 Merge branch 'dev' into dependabot/npm_and_yarn/acorn-5.7.4 2020-07-22 21:14:17 -07:00
9c8b0140a4 Merge branch 'dev' into dependabot/npm_and_yarn/actions/http-client-1.0.8 2020-07-22 21:13:00 -07:00
57920ca044 Merge branch 'heaths-issue10' into dev 2020-07-22 20:55:48 -07:00
0d4f73260b Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-20 00:55:11 +00:00
341cfb53e3 Bump @actions/http-client from 1.0.2 to 1.0.8
Bumps [@actions/http-client](https://github.com/actions/http-client) from 1.0.2 to 1.0.8.
- [Release notes](https://github.com/actions/http-client/releases)
- [Changelog](https://github.com/actions/http-client/blob/master/RELEASES.md)
- [Commits](https://github.com/actions/http-client/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2020-04-29 18:02:20 +00:00
c4f3bee2c4 Add tests for different path resolution 2020-04-21 17:04:39 -07:00
20e1303853 Fix tool lookup and revert logging 2020-04-21 16:57:28 -07:00
e9f4898311 Add more logging 2020-04-21 16:50:45 -07:00
9499ca8787 Fix path resolution
Looking for vswhere in the PATH was never triggered and had some bugs (like failing unconditionally if the code path was executed).
2020-04-21 16:27:45 -07:00
0ddbddf06e Quote vs-version example 2020-04-21 16:14:19 -07:00
80d0deb83b Use -latest and -version properly
Fixes #8
2020-04-21 15:46:27 -07:00
2f9b9c17d6 Use specific paths for faster lookup
Fixes #2
2020-04-21 15:38:49 -07:00
7d7af37b7e Fix sync/async callback issue 2020-04-21 15:38:49 -07:00
5cf04033c1 Use sync callback 2020-04-21 15:38:49 -07:00
f6890ff843 Fix typo 2020-04-21 15:38:49 -07:00
f486e795bf Add pull_request to Actions triggers 2020-04-21 15:38:49 -07:00
4652bfc96e Do not use newer -find parameter
Fixes #10
2020-04-21 15:38:49 -07:00
bb70c6a023 Find any product with MSBuild component
Fixes #7
2020-04-21 15:38:49 -07:00
dc59c705e4 Merge pull request #16 from microsoft/dev
Merge pull request #15 from microsoft/master
2020-04-21 13:22:43 -07:00
f05df80b32 Merge pull request #15 from microsoft/master
Adding remark about arguments in readme
2020-04-21 13:21:03 -07:00
43cd4ebaec Bump acorn from 5.7.3 to 5.7.4
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-26 15:44:00 +00:00
9c9a1a34a4 Adding remark about arguments in readme 2020-03-26 08:42:27 -07:00
9 changed files with 11104 additions and 172 deletions

View File

@ -1,25 +1,69 @@
name: "build-test-dev"
on:
pull_request:
branches:
- dev
paths-ignore:
- '*.md'
push:
branches:
- dev
paths-ignore:
- '*.md'
workflow_dispatch:
branches:
- dev
- arm64
- master
paths-ignore:
- '*.md'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup MSBuild
id: setup_msbuild
- name: Setup MSBuild (vswhere-path)
id: setup_msbuild_explicit
uses: ./
with:
vs-version: "[16.4,16.5]"
vswhere-path: C:\ProgramData\chocolatey\bin
- name: Setup MSBuild (PATH)
id: setup_msbuild_path
uses: ./
- name: Setup MSBuild (fallback)
id: setup_msbuild_fallback
uses: ./
env:
PATH: ''
- name: Setup MSBuild (x64)
if: always()
id: setup_msbuild_path_x64
uses: ./
with:
vs-prerelease: true
msbuild-architecture: 'x64'
- name: Setup MSBuild (arm64)
if: always()
id: setup_msbuild_path_arm
uses: ./
with:
vs-prerelease: true
msbuild-architecture: 'arm64'
- name: echo msbuild path
run: echo "${{ steps.setup_msbuild.outputs.msbuildPath }}"
run: |
echo "vswhere-path: ${{ steps.setup_msbuild_explicit.outputs.msbuildPath }}"
echo "PATH: ${{ steps.setup_msbuild_path.outputs.msbuildPath }}"
echo "ARM PATH: ${{ steps.setup_msbuild_path_arm.outputs.msbuildPath }}"
echo "ARM PATH: ${{ steps.setup_msbuild_path_x64.outputs.msbuildPath }}"
echo "Fallback: ${{ steps.setup_msbuild_fallback.outputs.msbuildPath }}"
- name: echo MSBuild
run: msbuild -version
run: msbuild -version

View File

@ -1,37 +1,82 @@
# microsoft/setup-msbuild
You know how handy that 'Visual Studio Developer Command Prompt' is on your local machine? And how it adds several things to `PATH` to allow you to just issue commands like `msbuild` or otherwise? Use this action to setup similar flexibility in your Windows-based GitHub Actions runners. This will let you discover where those tool paths are and automatically add them to the `PATH` environment variables for you so future steps in your Actions workflow can just initiate commands without knowing the full path.
## Usage
This action will help discover where the `MSBuild` tool is and automatically add it to the `PATH` environment variables for you so future steps in your Actions workflow can just initiate `msbuild` commands without knowing the full path.
```
> Please note this tool does NOT add other Visual Studio tools (like VSTest, cl, cmake, or others) to `PATH`
## Example Usage
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0
uses: microsoft/setup-msbuild@v1.1
- name: Build app for release
run: msbuild src\YourProjectFile.csproj -t:rebuild -verbosity:diag -property:Configuration=Release
```
## Specifying specific versions of Visual Studio
You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, enter that version number twice as a range.
## Runners and included software
```
This action is intended to be used within the GitHub Actions workflows using the model of 'runners' either hosted (provided by GitHub) or self-hosted (provided by you). The version and parameters you specify below are going to be scoped to what software actually exists on the runner image being used. For example, hosted runner images from GitHub typically do NOT have pre-release versions of Visual Studio on them so using `vs-prerelease` parameter noted below may not have intended effect when using hosted runners. The software included for GitHub-hosted runner iamges can always be found here: <https://github.com/actions/runner-images> which also includes information on when/how software on hosted images gets updated.
## Optional Parameters
There are a few additional parameters that can be set if you need them. These are optional and should only be set if you know that you need them or what you are doing.
### Specifying specific versions of Visual Studio (optional)
You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, specify the minimum and maximum versions as shown in the example below, which will look for just 16.4.
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0
with:
vs-version: [16.4,16.5]
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[16.4,16.5)'
```
The syntax is the same used for Visual Studio extensions, where square brackets like "[" mean inclusive, and parenthesis like "(" mean exclusive. A comma is always required, but eliding the minimum version looks for all older versions and eliding the maximum version looks for all newer versions. See the [vswhere wiki](https://github.com/microsoft/vswhere/wiki) for more details.
### Use pre-release versions of Visual Studio (optional)
If you need your Actions runner to target a pre-release version of Visual Studio, simply add the `vs-prerelease` input. This is necessary if you want to run an action on a virtual environment that contains a pre-release version of Visual Studio or self-hosted images that you may have that also have pre-release versions of Visual Studio installed.
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
vs-prerelease: true
```
### Specifying MSBuild architecture (optional)
By default the action will use the x86 architecture for MSBuild, but it is possible to target the x64 versions instead. Simply add the `msbuild-architecture` input. Valid input values are `x86` (default), `x64`, and `arm64`. Note that the success of these will rely on the runner OS.
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: x64
```
## How does this work?
This makes use of the vswhere tool which is a tool is delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using:
```
This makes use of the vswhere tool which is a tool delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using:
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.0
with:
vswhere-path: 'C:\path\to\your\tools\'
uses: microsoft/setup-msbuild@v1.1
with:
vswhere-path: 'C:\path\to\your\tools\'
```
## Notes on arguments
While the Action enables you to specify a `vswhere` path as well as a `vs-version`, these are more advanced options and when using GitHub-hosted runners you should not need these and is recommended you don't specify them as they are optional. Using these require you to fully understand the runner environment, updates to the tools on the runner, and can cause failures if you are out of sync. For GitHub-hosted runners, omitting these arguments is the preferred usage.
## Building this repo
As with most GitHub Actions, this requires NodeJS development tools. After installing NodeJS, you can build this by executing:
```
```bash
npm install
npm run build
npm run pack
@ -40,13 +85,14 @@ npm run pack
which will modify/create the /dist folder with the final index.js output
# Credits
Thank you to [Warren Buckley](https://github.com/warrenbuckley) for being a core contributor to this Action for the benefit of all developers!
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions

18
action-types.yml Normal file
View File

@ -0,0 +1,18 @@
# See https://github.com/krzema12/github-actions-typing
inputs:
vswhere-path:
type: string
vs-version:
type: string
vs-prerelease:
type: boolean
msbuild-architecture:
type: enum
name: Architecture
allowed-values:
- x86
- x64
- arm64
outputs:
msbuildPath:
type: string

View File

@ -1,20 +1,27 @@
name: 'setup-msbuild'
description: 'Helps set up MSBuild into PATH for later usage.'
author: 'Microsoft'
name: "setup-msbuild"
description: "Helps set up MSBuild into PATH for later usage."
author: "Microsoft"
branding:
color: purple
icon: terminal
inputs:
vswhere-path:
required: false
description: 'Folder location of where vswhere.exe is located if a self-hosted agent'
description: "Folder location of where vswhere.exe is located if a self-hosted agent"
vs-version:
description: 'Version of Visual Studio to search; defaults to latest if not specified'
description: "Version of Visual Studio to search; defaults to latest if not specified"
required: false
vs-prerelease:
description: "Enable searching for pre-release versions of Visual Studio/MSBuild"
required: false
msbuild-architecture:
description: 'The preferred processor architecture of MSBuild. Can be either "x86", "x64", or "arm64". "x64" is only available from Visual Studio version 17.0 and later.'
required: false
default: "x86"
outputs:
msbuildPath:
description: 'The resulting location of msbuild for your inputs'
description: "The resulting location of msbuild for your inputs"
runs:
using: 'node12'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"

29
building-release.md Normal file
View File

@ -0,0 +1,29 @@
# Building a release
This is a quick document to walk through the process of building and releasing.
## Building the version
- Create a new branch [vMajor.Minor.Revision] for the version from `dev`
- Make changes in the new branch
- Build the branch/package
- `npm install`
- `npm run build`
- `npm run pack`
- Prune the dependencies to only production
- `npm prune --production`
- Uncomment `node_modules` in `.gitignore` **for this branch only**
- Commit the changes to the branch
- Push the new version branch
- `git push origin [vMajor.Minor.Revision]`
## Releasing the new version
- Draft a new release to [vMajor.Minor.Revision]
## Update major version tag
If the update is non-breaking and the major version binding you can update the version tag to make the new release available to those binding to the major version tag ([GitHub Actions Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)).
Do this from the version branch after push (using a v1 tag as example only here)
```
git tag -fa v1 -m "Update v1 tag"
git push origin v1 --force
```

2581
dist/index.js vendored

File diff suppressed because it is too large Load Diff

8393
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "setup-msbuild",
"version": "1.0.0",
"version": "2.0.0",
"private": true,
"description": "Helps set up specific MSBuild tool into PATH for later usage.",
"main": "lib/main.js",
@ -11,7 +11,7 @@
"lint": "eslint src/**/*.ts",
"pack": "ncc build",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run pack && npm test"
"all": "npm run build && npm run format && npm run lint && npm run pack"
},
"repository": {
"type": "git",
@ -28,7 +28,7 @@
"author": "Microsoft",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.3",
"@actions/tool-cache": "^1.3.0"
},
@ -47,4 +47,4 @@
"ts-jest": "^24.2.0",
"typescript": "^3.6.4"
}
}
}

View File

@ -1,27 +1,25 @@
import * as core from '@actions/core'
import * as exec from '@actions/exec'
import * as fs from 'fs'
import * as path from 'path'
import * as io from '@actions/io'
import {ExecOptions} from '@actions/exec/lib/interfaces'
const IS_WINDOWS = process.platform === 'win32'
const VS_VERSION = core.getInput('vs-version') || 'latest'
const VSWHERE_PATH =
core.getInput('vswhere-path') ||
path.join(
process.env['ProgramFiles(x86)'] as string,
'Microsoft Visual Studio\\Installer'
)
const VSWHERE_PATH = core.getInput('vswhere-path')
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false'
let MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86'
// if a specific version of VS is requested
let VSWHERE_EXEC = ''
if (VS_VERSION === 'latest') {
VSWHERE_EXEC += '-latest '
} else {
VSWHERE_EXEC += `-version ${VS_VERSION} `
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '
if (ALLOW_PRERELEASE === 'true') {
VSWHERE_EXEC += ' -prerelease '
}
if (VS_VERSION !== 'latest') {
VSWHERE_EXEC += `-version "${VS_VERSION}" `
}
VSWHERE_EXEC +=
'-requires Microsoft.Component.MSBuild -find MSBuild\\**\\Bin\\MSBuild.exe'
core.debug(`Execution arguments: ${VSWHERE_EXEC}`)
@ -38,31 +36,77 @@ async function run(): Promise<void> {
if (VSWHERE_PATH) {
// specified a path for vswhere, use it
core.debug(`Using given vswhere-path: ${VSWHERE_PATH}`)
vswhereToolExe = path.join(VSWHERE_PATH, 'vswhere.exe')
} else {
// check in PATH to see if it is there
try {
const vsWhereInPath: string = await io.which('vswhere', true)
core.debug(`Found tool in PATH: ${vsWhereInPath}`)
vswhereToolExe = path.join(vsWhereInPath, 'vswhere.exe')
vswhereToolExe = vsWhereInPath
} catch {
// wasn't found because which threw
} finally {
core.setFailed(
'setup-msbuild requires the path to where vswhere.exe exists'
// fall back to VS-installed path
vswhereToolExe = path.join(
process.env['ProgramFiles(x86)'] as string,
'Microsoft Visual Studio\\Installer\\vswhere.exe'
)
core.debug(`Trying Visual Studio-installed path: ${vswhereToolExe}`)
}
}
if (!fs.existsSync(vswhereToolExe)) {
core.setFailed(
'setup-msbuild requires the path to where vswhere.exe exists'
)
return
}
core.debug(`Full tool exe: ${vswhereToolExe}`)
let foundToolPath = ''
const options: ExecOptions = {}
options.listeners = {
stdout: (data: Buffer) => {
// eslint-disable-next-line prefer-const
let output = data.toString()
foundToolPath += output
const installationPath = data.toString().trim()
core.debug(`Found installation path: ${installationPath}`)
// x64 and arm64 only exist in one possible location, so no fallback probing
if (MSBUILD_ARCH === 'x64' || MSBUILD_ARCH === 'arm64') {
// x64 is actually amd64 so change to that
if (MSBUILD_ARCH === 'x64') {
MSBUILD_ARCH = 'amd64'
}
let toolPath = path.join(
installationPath,
`MSBuild\\Current\\Bin\\${MSBUILD_ARCH}\\MSBuild.exe`
)
core.debug(`Checking for path: ${toolPath}`)
if (!fs.existsSync(toolPath)) {
return
}
foundToolPath = toolPath
} else {
let toolPath = path.join(
installationPath,
'MSBuild\\Current\\Bin\\MSBuild.exe'
)
core.debug(`Checking for path: ${toolPath}`)
if (!fs.existsSync(toolPath)) {
toolPath = path.join(
installationPath,
'MSBuild\\15.0\\Bin\\MSBuild.exe'
)
core.debug(`Checking for path: ${toolPath}`)
if (!fs.existsSync(toolPath)) {
return
}
}
foundToolPath = toolPath
}
}
}
@ -70,7 +114,7 @@ async function run(): Promise<void> {
await exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options)
if (!foundToolPath) {
core.setFailed('Unable to find msbuild.')
core.setFailed('Unable to find MSBuild.')
return
}