forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.86 KB
/
build-validation.yml
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
# This is a basic workflow to help you get started with Actions
name: "Snippets 5000"
# Controls when the action will run. Triggers the workflow on push or pull request
# events on the main branch only.
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
reason:
description: "The reason for running the workflow"
required: true
default: "Manual run"
env:
DOTNET_INSTALLER_CHANNEL: "7.0"
DOTNET_DO_INSTALL: "true" # True to install preview versions, False to use the pre-installed (released) SDK
EnableNuGetPackageRestore: "True"
repo: "docs"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "snippets-build"
snippets-build:
# The type of runner that the job will run on
runs-on: windows-2022
permissions:
statuses: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
# Get the latest preview SDK (or sdk not installed by the runner)
- name: Setup .NET SDK
if: ${{ env.DOTNET_DO_INSTALL == 'true' }}
run: |
echo "Downloading dotnet-install.ps1"
Invoke-WebRequest https://raw.githubusercontent.com/dotnet/install-scripts/master/src/dotnet-install.ps1 -OutFile dotnet-install.ps1
echo "Installing dotnet version ${{ env.DOTNET_INSTALLER_CHANNEL }}"
.\dotnet-install.ps1 -InstallDir "c:\program files\dotnet" -Channel "${{ env.DOTNET_INSTALLER_CHANNEL }}" -Quality preview
# Print dotnet info
- name: Display .NET info
run: |
dotnet --info
# Install locate projs global tool
- name: Install LocateProjects tool
run: |
dotnet tool install --global --add-source ./.github/workflows/dependencies/ DotnetDocsTools.LocateProjects
# Run locate projs tool
- name: Locate projects for PR
env:
GitHubKey: ${{ secrets.GITHUB_TOKEN }}
LocateExts: ".cs;.vb;.fs;.cpp;.h;.xaml;.razor;.cshtml;.vbhtml;.csproj;.fsproj;.vbproj;.vcxproj;.sln"
run: |
./.github/workflows/dependencies/Get-MSBuildResults.ps1 "${{ github.workspace }}" -PullRequest ${{ github.event.number }} -RepoOwner ${{ github.repository_owner }} -RepoName ${{ github.event.repository.name }}
# Update build output json file
- name: Upload build results
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: build
path: ./output.json
# Return status based on json file
- name: Report status
run: |
./.github/workflows/dependencies/Out-GithubActionStatus.ps1