Skip to content

Commit 87552b4

Browse files
Initial Commit
0 parents  commit 87552b4

26 files changed

+2242
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Update README
2+
on: [push, workflow_dispatch]
3+
4+
jobs:
5+
update_readme:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@master
10+
11+
- uses: cuchi/[email protected]
12+
with:
13+
template: README.md.tpl
14+
output_file: README.md
15+
data_file: integration-manifest.json
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.SDK_SYNC_PAT }}
18+
19+
- uses: stefanzweifel/git-auto-commit-action@v4
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
push_options: '--force'
24+
commit_message: Update generated README
25+
commit_user_name: Keyfactor
26+
commit_user_email: [email protected]
27+
commit_author: Keyfactor <[email protected]>
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Keyfactor Extension - Release
4+
5+
env:
6+
project_folder: Keyfactor.AnyAgent.AwsCertificateManager
7+
8+
# Controls when the action will run.
9+
on:
10+
# Triggers the workflow on pull requests closing
11+
pull_request:
12+
# only run this workflow when closing a PR to a branch that contains a release number. ignore -pre
13+
branches:
14+
- 'release-[0-9]+.[0-9]+'
15+
- '!release-[0-9]+.[0-9]+-pre'
16+
types: [closed]
17+
18+
# Allows you to run this workflow manually from the Actions tab
19+
workflow_dispatch:
20+
21+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
22+
jobs:
23+
# This workflow contains a single job called "build"
24+
build:
25+
# run if pull request is completed and merged, or if manually dispatched
26+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true)
27+
28+
# The type of runner that the job will run on
29+
runs-on: windows-latest
30+
31+
# Steps represent a sequence of tasks that will be executed as part of the job
32+
steps:
33+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
34+
- uses: actions/checkout@v2
35+
36+
- name: Setup Envrionment
37+
id: setup_env
38+
run: |
39+
echo "Setup Envrionment Variables for Workflow"
40+
echo "Working Path: ${Env:GITHUB_WORKSPACE}"
41+
$slnPath = (Get-ChildItem -Include *.sln -File -Recurse).fullname
42+
$relName = "${{ github.ref }}".Split("/")
43+
$repoName = "${{ github.repository }}".Split("/")
44+
echo "Solution File Path: ${slnPath}"
45+
echo "SOLUTION_PATH=${slnPath}" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
46+
echo "Release Name: $($relName[-1])"
47+
echo "RELEASE_NAME=$($relName[-1])" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
48+
echo "Repo Name: $($repoName[-1])"
49+
echo "REPO_NAME=$($repoName[-1])" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
50+
51+
- uses: actions/setup-dotnet@v1
52+
with:
53+
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
54+
#dotnet-version:
55+
56+
- name: Add Package Source
57+
run: |
58+
dotnet nuget add source https://nuget.pkg.github.com/Keyfactor/index.json -n github -u ${{ github.actor }} -p ${{ secrets.BUILD_PACKAGE_ACCESS }} --store-password-in-clear-text
59+
60+
# Configures msbuild path envrionment
61+
- name: setup-msbuild
62+
uses: microsoft/setup-msbuild@v1
63+
64+
# Restores Packages to Local Machine
65+
- name: restore nuget packages
66+
run: |
67+
nuget restore ${{ env.SOLUTION_PATH }}
68+
69+
- name: Create Release
70+
id: create_release
71+
#uses: zendesk/action-create-release@v1
72+
uses: keyfactor/action-create-release@786b73035fa09790f9eb11bb86834a6d7af1c256
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
release_name: Release ${{ env.RELEASE_NAME }}
77+
body: |
78+
[Changelog](../CHANGELOG.MD)
79+
draft: false
80+
prerelease: false
81+
auto_increment_type: patch
82+
tag_schema: semantic
83+
commitish: ${{ github.sha }}
84+
85+
#update version number of AssemblyInfo.cs file
86+
- name: Increment Assembly Version
87+
run: |
88+
$VersionRegex = "\d+\.\d+\.\d+"
89+
$assemblyInfoFiles = (Get-ChildItem -Include AssemblyInfo.cs -File -Recurse).fullname
90+
foreach ($assemblyInfoFile in $assemblyInfoFiles)
91+
{
92+
$filecontent = Get-Content($assemblyInfoFile)
93+
$newVer = "${{ steps.create_release.outputs.current_tag }}".TrimStart('v')
94+
attrib $assemblyInfoFile -r
95+
$filecontent -replace $VersionRegex, $newVer | Out-File $assemblyInfoFile
96+
}
97+
98+
- name: Execute MSBuild Commands
99+
run: |
100+
MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=false -p:Configuration=Release
101+
102+
- name: Archive Files
103+
if: ${{ success() }}
104+
run: |
105+
md ${{ github.workspace }}\zip\Keyfactor
106+
Compress-Archive -Path ${{ github.workspace }}\${{env.project_folder}}\bin\Release\*.dll,${{ github.workspace }}\${{env.project_folder}}\bin\Release\*.json -DestinationPath ${{ github.workspace }}\zip\Keyfactor\$Env:REPO_NAME.zip -Force
107+
108+
- name: Upload Release Asset (x64)
109+
if: ${{ success() }}
110+
id: upload-release-asset-x64
111+
uses: actions/upload-release-asset@v1
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
with:
115+
upload_url: ${{ steps.create_release.outputs.upload_url }}
116+
asset_path: ${{ github.workspace }}\zip\Keyfactor\${{ env.REPO_NAME}}.zip
117+
asset_name: ${{ env.REPO_NAME}}_${{ steps.create_release.outputs.current_tag }}.zip
118+
asset_content_type: application/zip
119+
120+
- name: On Failure - Remove Tags and Release
121+
if: ${{ failure() }}
122+
uses: dev-drprasad/[email protected]
123+
with:
124+
delete_release: true # default: false
125+
tag_name: ${{ steps.create_release.outputs.current_tag }}
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)