Skip to content

Commit 0693e01

Browse files
author
Hugh Scott
committed
Merge branch 'dev' of https://github.com/hmscott4/AlertManagement into dev
2 parents 605ff8a + 70a84cf commit 0693e01

File tree

3 files changed

+28
-50
lines changed

3 files changed

+28
-50
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,34 @@
11
name: Build Management Pack
22

3-
# Run when a pull request is closed
3+
# When a push occurs to the dev or main branches
44
on:
5-
pull_request:
5+
push:
66
branches:
7-
types: [closed]
7+
- dev
8+
- main
89

910
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1011
jobs:
1112
build:
12-
# Only run when a pull request is merged to dev or main
13-
if: |
14-
( github.event.pull_request.merged == true ) &&
15-
(
16-
( github.base_ref == 'main' ) ||
17-
( github.base_ref == 'dev' )
18-
)
13+
# Only run when a push occurs to dev or main
14+
if: ( github.ref == 'refs/heads/main' ) || ( github.ref == 'refs/heads/dev' )
1915

2016
# Specify the version of Windows
2117
runs-on: windows-latest
2218

2319
steps:
2420
# Check out the repository the pull request in merging into (dev/main)
25-
#- name: Checkout Base Repo
26-
# uses: actions/checkout@v2
27-
# with:
28-
# github-token: ${{ secrets.AM_REPO_BUILD }}
29-
# ref: ${{ github.event.pull_request.base.sha }}
30-
# path: base
31-
32-
- name: Checkout Head Repo
21+
- name: Checkout Base Repo
3322
uses: actions/checkout@v2
3423
with:
35-
ref: ${{ github.event.pull_request.head.sha }}
36-
repository: ${{ github.event.pull_request.head.repo.full_name }}
37-
path: head
24+
path: base
25+
token: ${{ secrets.GITHUB_TOKEN }}
3826

3927
# Execute the build PowerShell script
4028
- name: Execute build script
41-
if: |
42-
( github.base_ref == 'main' ) ||
43-
( ( github.base_ref == 'dev' ) && ( github.head_ref != 'main' ) )
29+
if: ( github.ref == 'refs/heads/main' ) || ( github.ref == 'refs/heads/dev' )
4430
shell: powershell
45-
run: .\head\Build\build.ps1
31+
run: .\base\Build\build.ps1
4632

4733
# Upload the management pack files as artifacts
4834
- name: Upload Artifacts
@@ -53,7 +39,7 @@ jobs:
5339

5440
# Create a release of the management pack
5541
- name: Generate Release
56-
if: github.base_ref == 'main'
42+
if: github.ref == 'refs/heads/main'
5743
uses: softprops/action-gh-release@v1
5844
with:
5945
name: v${{ env.Version }}
@@ -65,7 +51,7 @@ jobs:
6551

6652
# Create a beta release of the management pack
6753
- name: Generate Beta Release
68-
if: github.base_ref == 'dev'
54+
if: github.ref == 'refs/heads/dev'
6955
uses: softprops/action-gh-release@v1
7056
with:
7157
name: v${{ env.Version }}
@@ -74,18 +60,3 @@ jobs:
7460
files: ${{ env.ArtifactFileName }}
7561
env:
7662
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
78-
# Open a pull request for dev <- main
79-
- name: Open pull to commit into dev from main
80-
if: ( github.base_ref == 'main' ) && ( github.head_ref == 'dev' )
81-
uses: peter-evans/create-pull-request@v3
82-
with:
83-
path: head
84-
commit-message: Update dev version to v${{ env.Version }}
85-
committer: GitHub Actions Bot <[email protected]>
86-
author: GitHub Actions Bot <[email protected]>
87-
branch: main
88-
delete-branch: false
89-
base: dev
90-
title: Rebase dev
91-
body: Update dev to v${{ env.Version }} from main.

Build/build.ps1

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Set the verbose preference
22
$VerbosePreference = 'Continue'
33

4-
Write-Verbose -Message "GITHUB_BASE_REF: $($env:GITHUB_BASE_REF)"
5-
Write-Verbose -Message "GITHUB_HEAD_REF: $($env:GITHUB_HEAD_REF)"
4+
Write-Verbose -Message "GITHUB_REF: $($env:GITHUB_REF)"
65

76
# Download the System Center Visual Studio Authoring Extensions (VSAE)
87
$invokeWebRequestParams = @{
@@ -21,7 +20,7 @@ msiexec /quiet /i $vsaeMsiFile.FullName
2120
$vsWherePath = Join-Path -Path ( Join-Path -Path ( Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'Microsoft Visual Studio' ) -ChildPath Installer ) -ChildPath vswhere.exe
2221
Write-Verbose -Message "vswhere.exe path: $vsWherePath"
2322

24-
$solutions = Get-ChildItem -Path Head -Filter *.sln -Recurse
23+
$solutions = Get-ChildItem -Path base -Filter *.sln -Recurse
2524
Write-Verbose -Message ( "Solution Files: `n {0}" -f ( $solutions.FullName -join "`n " ) )
2625

2726
foreach ( $solution in $solutions )
@@ -114,7 +113,7 @@ foreach ( $solution in $solutions )
114113
}
115114

116115
# Verify the management pack files were created
117-
$buildFiles = Get-ChildItem -Path .\head\*\bin\Release\*
116+
$buildFiles = Get-ChildItem -Path .\base\*\bin\Release\*
118117
Write-Verbose -Message ( "Management Pack Files:`n {0}" -f ( $buildFiles.FullName -join "`n " ) )
119118

120119
# Find the relevant file to release
@@ -133,7 +132,7 @@ foreach ( $solution in $solutions )
133132

134133
if ( -not $releaseFile )
135134
{
136-
throw 'No management pack files found in ".\head\*\bin\Release\*"'
135+
throw 'No management pack files found in ".\base\*\bin\Release\*"'
137136
}
138137
else
139138
{
@@ -143,15 +142,23 @@ foreach ( $solution in $solutions )
143142
# Create the file name
144143
Write-Output -InputObject "ArtifactFileName=$($releaseFile.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
145144
}
145+
146+
if ( $env:GITHUB_REF -match 'main' )
147+
{
148+
$releaseHistoryFile = Get-Item -Path '.\base\WikiSource\Release History.md'
149+
$releaseHistory = Get-Content -Path $releaseHistoryFile
150+
$releaseHistory = $releaseHistory -replace '## Unreleased',"v$($newVersion.ToString())"
151+
$releaseHistory | Set-Content -Path $releaseHistoryFile
152+
}
146153

147154
# Commit the version update to the reference repo
148155
Push-Location
149-
Set-Location -Path head
156+
Set-Location -Path base
150157
git config user.name "GitHub Actions Bot"
151158
git config user.email "<[email protected]>"
152159
git add $projectFile.FullName
153160
git add $projectUserFile.FullName
154161
git commit -m $commitComment
155-
git push
162+
git push origin HEAD:$($env:GITHUB_REF)
156163
Pop-Location
157164
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The **Alert Management** SCOM management pack is a tool for managing alerts thro
66

77
### Production Release
88

9-
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/randomnote1/ScomManagementPackTemplate?label=Alert%20Management)](../../../AlertManagement/releases/latest)
9+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/hmscott4/AlertManagement?label=Alert%20Management)](../../../AlertManagement/releases/latest)
1010

1111
[![Alert Management](https://img.shields.io/badge/Alert%20Management-Documentation-blue)](../../../AlertManagement/wiki)
1212

0 commit comments

Comments
 (0)