Skip to content

Commit 5eb56b3

Browse files
committed
update release action to latest iteration
1 parent a19fa18 commit 5eb56b3

File tree

2 files changed

+43
-16
lines changed

2 files changed

+43
-16
lines changed

.github/workflows/keyfactor-extension-release.yml

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
name: Keyfactor Extension - Release
44

5+
env:
6+
SOLUTION_FOLDER: '.'
7+
PROJECT_FOLDER: 'IISWithBindings'
8+
59
# Controls when the action will run.
610
on:
7-
# Triggers the workflow on push
8-
push:
9-
#only run this workflow when pushing to a branch that contains a release number. ignore -pre
11+
# Triggers the workflow on pull requests closing
12+
pull_request:
13+
# only run this workflow when closing a PR to a branch that contains a release number. ignore -pre
1014
branches:
11-
- 'release-[12].[0-9]+'
12-
- '!release-[12].[0-9]+.[0-9]+-pre*'
15+
- 'release-[0-9]+.[0-9]+'
16+
- '!release-[0-9]+.[0-9]+-pre'
17+
types: [closed]
1318

1419
# Allows you to run this workflow manually from the Actions tab
1520
workflow_dispatch:
@@ -18,6 +23,9 @@ on:
1823
jobs:
1924
# This workflow contains a single job called "build"
2025
build:
26+
# run if pull request is completed and merged, or if manually dispatched
27+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true)
28+
2129
# The type of runner that the job will run on
2230
runs-on: windows-latest
2331

@@ -34,12 +42,15 @@ jobs:
3442
$slnPath = (Get-ChildItem -Include *.sln -File -Recurse).fullname
3543
$relName = "${{ github.ref }}".Split("/")
3644
$repoName = "${{ github.repository }}".Split("/")
45+
$relVersion = "${{ github.ref }}".Split("-")
3746
echo "Solution File Path: ${slnPath}"
3847
echo "SOLUTION_PATH=${slnPath}" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
3948
echo "Release Name: $($relName[-1])"
4049
echo "RELEASE_NAME=$($relName[-1])" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
4150
echo "Repo Name: $($repoName[-1])"
4251
echo "REPO_NAME=$($repoName[-1])" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
52+
echo "Release Version: $($relVersion[-1])"
53+
echo "RELEASE_VERSION=$($relVersion[-1])" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
4354
4455
- uses: actions/setup-dotnet@v1
4556
with:
@@ -66,35 +77,45 @@ jobs:
6677
env:
6778
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6879
with:
69-
release_name: Release 1.0.3
80+
release_name: ${{ env.REPO_NAME }} ${{ env.RELEASE_VERSION }}
7081
body: |
71-
Add SNI support for new bindings when adding certificates to an IIS Store
7282
[Changelog](../CHANGELOG.MD)
7383
draft: false
7484
prerelease: false
7585
auto_increment_type: patch
7686
tag_schema: semantic
7787
commitish: ${{ github.sha }}
7888

79-
#update version number of AssemblyInfo.cs file
89+
# update version number of AssemblyInfo.cs file
8090
- name: Increment Assembly Version
8191
run: |
8292
$VersionRegex = "\d+\.\d+\.\d+"
83-
$assemlyFilePath = (Get-ChildItem -Include AssemblyInfo.cs -File -Recurse -Path .\IISWithBindings\).fullname
84-
$filecontent = Get-Content($assemlyFilePath)
85-
$newVer = "${{ steps.create_release.outputs.current_tag }}".TrimStart('v')
86-
attrib $assemlyFilePath -r
87-
$filecontent -replace $VersionRegex, $newVer | Out-File $assemlyFilePath
93+
$assemblyInfoFiles = (Get-ChildItem -Include AssemblyInfo.cs -File -Recurse).fullname
94+
if ($assemblyInfoFiles -ne $null)
95+
{
96+
$newVer = "${{ steps.create_release.outputs.current_tag }}".TrimStart('v').Split('-')[0]
97+
echo "Prepared to overwrite Assembly version to: ${newVer}"
98+
foreach ($assemblyInfoFile in $assemblyInfoFiles)
99+
{
100+
$filecontent = Get-Content($assemblyInfoFile)
101+
attrib $assemblyInfoFile -r
102+
$filecontent -replace $VersionRegex, $newVer | Out-File $assemblyInfoFile
103+
}
104+
}
88105
89106
- name: Execute MSBuild Commands
90107
run: |
91-
MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=false -p:Configuration=Release
108+
$newVer = "${{ steps.create_release.outputs.current_tag }}".TrimStart('v').Split('-')[0]
109+
MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=false -p:Configuration=Release -p:Version=$newVer
92110
93111
- name: Archive Files
94112
if: ${{ success() }}
95113
run: |
96114
md ${{ github.workspace }}\zip\Keyfactor
97-
Compress-Archive -Path ${{ github.workspace }}\IISWithBindings\bin\Release\*.dll -DestinationPath ${{ github.workspace }}\zip\Keyfactor\$Env:REPO_NAME.zip -Force
115+
Compress-Archive -Path `
116+
${{ env.SOLUTION_FOLDER }}\${{ env.PROJECT_FOLDER }}\bin\Release\netcoreapp3.1\*, `
117+
${{ env.SOLUTION_FOLDER }}\integration-manifest.json `
118+
-DestinationPath ${{ github.workspace }}\zip\Keyfactor\$Env:REPO_NAME.zip -Force
98119
99120
- name: Upload Release Asset (x64)
100121
if: ${{ success() }}
@@ -108,7 +129,7 @@ jobs:
108129
asset_name: ${{ env.REPO_NAME}}_${{ steps.create_release.outputs.current_tag }}.zip
109130
asset_content_type: application/zip
110131

111-
- name: On Failure Remove Tags and Release
132+
- name: On Failure - Remove Tags and Release
112133
if: ${{ failure() }}
113134
uses: dev-drprasad/[email protected]
114135
with:

IISWithBindings/IISWithBindings.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<RootNamespace>Keyfactor.Extensions.Orchestrator.IISWithBinding</RootNamespace>
6+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
7+
</PropertyGroup>
8+
9+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
10+
<DebugType>none</DebugType>
11+
<DebugSymbols>false</DebugSymbols>
612
</PropertyGroup>
713

814
<ItemGroup>

0 commit comments

Comments
 (0)