Compare commits

..

12 Commits

Author SHA1 Message Date
Jason DeVito
4244b394e7 fix: removes old betabuild action 2023-09-26 09:03:37 -05:00
Jason DeVito
2586e9502d Create essentialsplugins-betabuilds-caller.yml 2023-09-26 08:57:39 -05:00
Andrew Welker
0746d309df Merge pull request #19 from PepperDash/feature/Conditional-Workflows
Multiple Style and Workflow Updates
2022-07-22 11:06:34 -06:00
Trevor Payne
259a71c562 style: renamed classes for consistency
build: updated essentials version

ci: updated workflows

docs: documentation updated

ci: updated nuspec
2022-07-21 12:07:27 -05:00
Trevor Payne
62f959bb25 test workflow syntax 2022-07-21 10:17:56 -05:00
Trevor Payne
62912451e8 fix: Workflow Syntax 2022-07-20 22:15:48 -05:00
Trevor Payne
ee057ad361 fix: Workflow Syntax 2022-07-20 21:47:09 -05:00
Trevor Payne
af7e9ae659 fix: Workflow Syntax 2022-07-20 21:03:26 -05:00
Trevor Payne
f08741efd6 fix: Workflow Syntax 2022-07-20 20:32:42 -05:00
Trevor Payne
1add0c193c fix: Workflow Syntax 2022-07-20 18:34:20 -05:00
Trevor Payne
3d57ac3560 fix: Workflow Syntax 2022-07-20 18:18:07 -05:00
Trevor Payne
856178d920 fix: Workflow Syntax 2022-07-20 17:53:48 -05:00
4 changed files with 49 additions and 316 deletions

View File

@@ -0,0 +1,22 @@
name: Beta Build
on:
push:
branches-ignore:
- "main"
workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: true
type: string
jobs:
call-workflow:
uses: PepperDash/workflow-templates/.github/workflows/essentialsplugins-builds.yml@main
secrets: inherit
with:
branch: ${{ github.ref_name }}
default-branch: "main"

View File

@@ -1,286 +0,0 @@
name: Branch Build Using Docker
on:
push:
branches:
- feature/*
- hotfix/*
- release/*
- dev*
env:
# Do not edit this, we're just creating it here
VERSION: 0.0.0-buildtype-buildnumber
# Defaults to debug for build type
BUILD_TYPE: Debug
# Defaults to master as the release branch. Change as necessary
RELEASE_BRANCH: main
jobs:
Build_Project:
runs-on: windows-2019
steps:
# First we checkout the source repo
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
# Fetch all tags
- name: Fetch tags
run: git fetch --tags
# Generate the appropriate version number
- name: Set Version Number
shell: powershell
run: |
$latestVersions = $(git tag --merged origin/main)
$latestVersion = [version]"0.0.0"
Foreach ($version in $latestVersions) {
Write-Host $version
try {
if (([version]$version) -ge $latestVersion) {
$latestVersion = $version
Write-Host "Setting latest version to: $latestVersion"
}
}
catch {
Write-Host "Unable to convert $($version). Skipping"
continue;
}
}
$newVersion = [version]$latestVersion
$phase = ""
$newVersionString = ""
switch -regex ($Env:GITHUB_REF) {
'^refs\/heads\/main*.' {
$newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build
}
'^refs\/heads\/feature\/*.' {
$phase = 'alpha'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/release\/*.' {
$splitRef = $Env:GITHUB_REF -split "/"
$version = [version]($splitRef[-1] -replace "v", "")
$phase = 'rc'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/dev*.' {
$phase = 'beta'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/hotfix\/*.' {
$phase = 'hotfix'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
}
echo "VERSION=$newVersionString" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Use the version number to set the version of the assemblies
- name: Update AssemblyInfo.cs
shell: powershell
run: |
function Update-SourceVersion {
Param ([string]$Version)
#$fullVersion = $Version
$baseVersion = [regex]::Match($Version, "(\d+.\d+.\d+).*").captures.groups[1].value
$NewAssemblyVersion = 'AssemblyVersion("' + $baseVersion + '.*")'
Write-Output "AssemblyVersion = $NewAssemblyVersion"
$NewAssemblyInformationalVersion = 'AssemblyInformationalVersion("' + $Version + '")'
Write-Output "AssemblyInformationalVersion = $NewAssemblyInformationalVersion"
foreach ($o in $input) {
Write-output $o.FullName
$TmpFile = $o.FullName + ".tmp"
get-content $o.FullName |
ForEach-Object {
$_ -replace 'AssemblyVersion\(".*"\)', $NewAssemblyVersion } |
ForEach-Object {
$_ -replace 'AssemblyInformationalVersion\(".*"\)', $NewAssemblyInformationalVersion
} > $TmpFile
move-item $TmpFile $o.FullName -force
}
}
function Update-AllAssemblyInfoFiles ( $version ) {
foreach ($file in "AssemblyInfo.cs", "AssemblyInfo.vb" ) {
get-childitem -Path $Env:GITHUB_WORKSPACE -recurse | Where-Object { $_.Name -eq $file } | Update-SourceVersion $version ;
}
}
# validate arguments
$r = [System.Text.RegularExpressions.Regex]::Match($Env:VERSION, "\d+\.\d+\.\d+.*");
if ($r.Success) {
Write-Output "Updating Assembly Version to $Env:VERSION ...";
Update-AllAssemblyInfoFiles $Env:VERSION;
}
else {
Write-Output " ";
Write-Output "Error: Input version $Env:VERSION does not match x.y.z format!"
Write-Output " ";
Write-Output "Unable to apply version to AssemblyInfo.cs files";
}
- name: restore Nuget Packages
run: nuget install .\packages.config -OutputDirectory .\packages -ExcludeVersion
# Set the SOLUTION_PATH
- name: Get SLN Path
shell: powershell
run: |
$solution_path = Get-ChildItem *.sln -recurse
$solution_path = $solution_path.FullName
$solution_path = $solution_path -replace "(?:[^\\]*\\){4}", ""
Write-Output $solution_path
echo "SOLUTION_PATH=$($solution_path)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Set the SOLUTION_FILE
- name: Get SLN File
shell: powershell
run: |
$solution_file = Get-ChildItem .\*.sln -recurse -Path "$($Env:GITHUB_WORKSPACE)"
echo "SOLUTION_FILE=$($solution_file.BaseName)"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Login to Docker
- name: Login to Docker
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Build the solutions in the docker image
- name: Build Solution
shell: powershell
run: |
Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_PATH)"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)"
# Zip up the output files as needed
- name: Zip Build Output
shell: powershell
run: |
$destination = "$($Env:GITHUB_HOME)\output"
New-Item -ItemType Directory -Force -Path ($destination)
Get-ChildItem ($destination)
$exclusions = "packages"
# Trying to get any .json schema files (not currently working)
# Gets any files with the listed extensions.
Get-ChildItem -recurse -Path "$($Env:GITHUB_WORKSPACE)" -include "*.clz", "*.cpz", "*.cplz", "*.nuspec" | ForEach-Object {
$allowed = $true;
# Exclude any files in submodules
foreach ($exclude in $exclusions) {
if ((Split-Path $_.FullName -Parent).contains("$($exclude)")) {
$allowed = $false;
break;
}
}
if ($allowed) {
Write-Host "allowing $($_)"
$_;
}
} | Copy-Item -Destination ($destination) -Force
Write-Host "Getting matching files..."
# Get any files from the output folder that match the following extensions
Get-ChildItem -Path $destination | Where-Object {($_.Extension -eq ".clz") -or ($_.Extension -eq ".cpz" -or ($_.Extension -eq ".cplz"))} | ForEach-Object {
# Replace the extensions with dll and xml and create an array
$filenames = @($($_ -replace "cpz|clz|cplz", "dll"), $($_ -replace "cpz|clz|cplz", "xml"))
Write-Host "Filenames:"
Write-Host $filenames
if ($filenames.length -gt 0) {
# Attempt to get the files and return them to the output directory
Get-ChildItem -Recurse -Path "$($Env:GITHUB_WORKSPACE)" -include $filenames | Copy-Item -Destination ($destination) -Force
}
}
Get-ChildItem -Path $destination\*.cplz | Rename-Item -NewName { "$($_.BaseName)-$($Env:VERSION)$($_.Extension)" }
Compress-Archive -Path $destination -DestinationPath "$($Env:GITHUB_WORKSPACE)\$($Env:SOLUTION_FILE)-$($Env:VERSION).zip" -Force
Write-Host "Output Contents post Zip"
Get-ChildItem -Path $destination
# Write the version to a file to be consumed by the push jobs
- name: Write Version
run: Write-Output "$($Env:VERSION)" | Out-File -FilePath "$($Env:GITHUB_HOME)\output\version.txt"
# Upload output files
- name: Upload Build Output
uses: actions/upload-artifact@v1
with:
name: Build
path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip
# Upload the Version file as an artifact
- name: Upload version.txt
uses: actions/upload-artifact@v1
with:
name: Version
path: ${{env.GITHUB_HOME}}\output\version.txt
# Create the release on the source repo
- name: Create Release
id: create_release
uses: fleskesvor/create-release@feature/support-target-commitish
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload the build package to the release
- name: Upload Release Package
id: upload_release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip
asset_name: ${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Push_Nuget_Package:
needs: Build_Project
runs-on: windows-2019
env:
NUSPECNAME: default
steps:
- name: Get nuget File
shell: powershell
run: |
$nuspec = Get-ChildItem *.nuspec -recurse
$NUSPECNAME = $nuspec.BaseName
echo "NUSPEC_FILE=$($NUSPECNAME)"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Download Build Version Info
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
uses: actions/download-artifact@v1
with:
name: Version
- name: Set Version Number
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
shell: powershell
run: |
Get-ChildItem "./Version"
$version = Get-Content -Path ./Version/version.txt
Write-Host "Version: $version"
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
- name: Download Build output
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
uses: actions/download-artifact@v1
with:
name: Build
path: ./
- name: Unzip Build file
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: |
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
Remove-Item -Path .\*.zip
- name: Copy Files to root & delete output directory
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
#Pushes to github nuget store
- name: Add nuget.exe
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
uses: nuget/setup-nuget@v1
- name: Add Github Packages source
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }}
# Pushes to nuget gallery, not needed unless publishing publicly
- name: Add nuget.org API Key
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: nuget setApiKey ${{ secrets.NUGET_API_KEY }}
- name: Create nuget package
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: nuget pack "./${{ env.NUSPEC_FILE}}.nuspec" -version ${{ env.VERSION }}
- name: Publish nuget package to Github registry
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: nuget push **/*.nupkg -source github
- name: Publish nuget package to nuget.org
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json

View File

@@ -170,23 +170,12 @@ jobs:
Push_Nuget_Package:
needs: Build_Project
runs-on: windows-2019
env:
NUSPECNAME: default
steps:
- name: Get nuget File
shell: powershell
run: |
$nuspec = Get-ChildItem *.nuspec -recurse
$NUSPECNAME = $nuspec.BaseName
echo "NUSPEC_FILE=$($NUSPECNAME)"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Download Build Version Info
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
uses: actions/download-artifact@v1
with:
name: Version
- name: Set Version Number
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
shell: powershell
run: |
Get-ChildItem "./Version"
@@ -196,39 +185,43 @@ jobs:
Remove-Item -Path ./Version/version.txt
Remove-Item -Path ./Version
- name: Download Build output
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
uses: actions/download-artifact@v1
with:
name: Build
path: ./
- name: Unzip Build file
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: |
Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\
Remove-Item -Path .\*.zip
- name: Copy Files to root & delete output directory
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: |
Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz")
Get-ChildItem -Path .\output\* | Copy-Item -Destination .\
Remove-Item -Path .\output -Recurse
#Pushes to github nuget store
- name: Get nuget File
shell: powershell
run: |
$nuspec_file = (Get-ChildItem *.nuspec -recurse).BaseName
echo "NUSPEC_FILE=$($nuspec_file)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Pulls the nuget builder packages
- name: Add nuget.exe
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
if: "!contains(env.NUSPEC_FILE, 'EssentialsPluginTemplate')"
uses: nuget/setup-nuget@v1
# Creating nuget Packages
- name: Add Github Packages source
if: ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
if: "!contains(env.NUSPEC_FILE, 'EssentialsPluginTemplate')"
run: nuget sources add -name github -source https://nuget.pkg.github.com/pepperdash/index.json -username Pepperdash -password ${{ secrets.GITHUB_TOKEN }}
# Pushes to nuget gallery, not needed unless publishing publicly
- name: Add nuget.org API Key
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
run: nuget setApiKey ${{ secrets.NUGET_API_KEY }}
- name: Create nuget package
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
if: "!contains(env.NUSPEC_FILE, 'EssentialsPluginTemplate')"
run: nuget pack "./${{ env.NUSPEC_FILE}}.nuspec" -version ${{ env.VERSION }}
# Pushes to internal github registry
- name: Publish nuget package to Github registry
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
if: "!contains(env.NUSPEC_FILE, 'EssentialsPluginTemplate')"
run: nuget push **/*.nupkg -source github
# Pushes to nuget gallery
- name: Add nuget.org API Key
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && !contains(env.NUSPEC_FILE, 'EssentialsPluginTemplate')
run: nuget setApiKey ${{ secrets.NUGET_API_KEY }}
- name: Publish nuget package to nuget.org
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && ${{env.NUSPECNAME != 'PDT.EssentialsPluginTemplate'}}
if: github.repository_owner == 'PepperDash' && github.repository_visibility == 'public' && !contains(env.NUSPEC_FILE, 'EssentialsPluginTemplate')
run: nuget push **/*.nupkg -Source https://api.nuget.org/v3/index.json

View File

@@ -29,6 +29,7 @@ The [Essentials](https://github.com/PepperDash/Essentials) libraries are require
To install dependencies once nuget.exe is installed, run the following command from the root directory of your repository:
`nuget install .\packages.config -OutputDirectory .\packages -excludeVersion`.
Alternatively, you can simply run the `GetPackages.bat` file.
To verify that the packages installed correctly, open the plugin solution in your repo and make sure that all references are found, then try and build it.
### Installing Different versions of PepperDash Core
@@ -37,7 +38,7 @@ If you need a different version of PepperDash Core, use the command `nuget insta
### Instructions for Renaming Solution and Files
See the Task List in Visual Studio for a guide on how to start using the templage. There is extensive inline documentation and examples as well.
See the Task List in Visual Studio for a guide on how to start using the template. There is extensive inline documentation and examples as well.
For renaming instructions in particular, see the XML `remarks` tags on class definitions
@@ -45,10 +46,13 @@ For renaming instructions in particular, see the XML `remarks` tags on class def
## Generating Nuget Package
In the solution folder is a file named "PDT.EssentialsPluginTemplate.nuspec-TEMPLATE"
In the solution folder is a file named "PDT.EssentialsPluginTemplate.nuspec"
1. Remove the -TEMPLATE so that the extention is .nuspec.
2. Rename the file to match your plugin solution name
3. Edit the file to include your project specifics including
1. Rename the file to match your plugin solution name
2. Edit the file to include your project specifics including
1. <id>PepperDash.Essentials.Plugin.MakeModel</id> Convention is to use the prefix "PepperDash.Essentials.Plugin" and include the MakeModel of the device.
2. <projectUrl>https://github.com/PepperDash/EssentialsPluginTemplate</projectUrl> Change to your url to the project repo
2. <projectUrl>https://github.com/PepperDash/EssentialsPluginTemplate</projectUrl> Change to your url to the project repo
There is no longer a requirement to adjust workflow files for nuget generation for private and public repositories. This is now handled automatically in the workflow.
__If you do not make these changes to the nuspec file, the project will not generate a nuget package__