Skip to content

Commit

Permalink
Merge 5b4ba3d into 9b30b5f
Browse files Browse the repository at this point in the history
  • Loading branch information
doebrowsk authored Oct 28, 2024
2 parents 9b30b5f + 5b4ba3d commit 389e029
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 33 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/assign-env-from-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
update_catalog:
description: The release_dir property from integration-manifest.json
value: ${{ jobs.assign-from-json.outputs.update_catalog }}
release_project:
description: The release_project property from integration-manifest.json
value: ${{ jobs.assign-from-json.outputs.release_project }}
UOFramework:
description: The UOFramework property from integration-manifest.json
value: ${{ jobs.assign-from-json.outputs.UOFramework }}
Expand All @@ -28,6 +31,7 @@ jobs:
update_catalog: ${{ steps.read-update_catalog.outputs.output-value }}
UOFramework: ${{ steps.read-UOFramework.outputs.output-value }}
description: ${{ steps.read-description.outputs.output-value }}
release_project: ${{ steps.read-release_project.outputs.output-value }}
name: Set workflow variables from integration-manifest.json
steps:
- name: checkout-json-file
Expand Down Expand Up @@ -60,6 +64,14 @@ jobs:
input-file: 'src/integration-manifest.json'
input-property: 'integration_type'

- name: Read release_project property
uses: ./tools
id: read-release_project
with:
input-file: 'src/integration-manifest.json'
input-property: 'release_project'
required-value: 'false'

- name: Read update_catalog property
uses: ./tools
id: read-update_catalog
Expand Down Expand Up @@ -122,5 +134,6 @@ jobs:
fi
fi
echo "* ${{ steps.read-release_dir.outputs.output-property }} : ${{ steps.read-release_dir.outputs.output-value }}" >> $GITHUB_STEP_SUMMARY
echo "* ${{ steps.read-release_project.outputs.output-property }} : ${{ steps.read-release_project.outputs.output-value }}" >> $GITHUB_STEP_SUMMARY
83 changes: 57 additions & 26 deletions .github/workflows/dotnet-build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: The relative directory inside the repo where the build artifacts to publish for release will be located
required: false
type: string
release_project:
description: The relative file location for csproj
required: false
type: string
integration_type:
description: The extension integration_type
required: true
Expand Down Expand Up @@ -74,6 +78,7 @@ jobs:
if ($assemblyInfoFiles -ne $null)
{
$newVer = "${{ inputs.release_version || '1.0.0' }}".TrimStart('v').Split('-')[0]
echo "newver=${newVer}" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
echo "Prepared to overwrite Assembly version to: ${newVer}"
foreach ($assemblyInfoFile in $assemblyInfoFiles)
{
Expand All @@ -88,37 +93,63 @@ jobs:
$newVer = "${{ inputs.release_version || '1.0.0' }}".TrimStart('v').Split('-')[0]
MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=false -p:Configuration=Release -p:Version=$newVer
- name: Check for manifest
if: success() && env.CREATE_RELEASE == 'True' && inputs.integration_type == 'orchestrator'
- name: Read Target Frameworks
id: read_target_frameworks
shell: pwsh
run: |
$fileExists = Get-ChildItem -Path ${{ github.workspace }}\${{ inputs.release_dir }} -Recurse -Filter 'manifest.json' | Select-Object -First 1
if (-not $fileExists) { exit 1 }
[xml]$csproj = Get-Content "${{ inputs.release_project }}"
$targetFrameworks = $csproj.Project.PropertyGroup.TargetFrameworks
if ($null -eq $targetFrameworks) {
$targetFrameworks = $csproj.Project.PropertyGroup.TargetFramework
}
echo "release_platforms: $targetFrameworks"
echo "release_platforms=$targetFrameworks" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
- name: Archive Files
if: success() && env.CREATE_RELEASE == 'True'
shell: pwsh
run: |
md ${{ github.workspace }}\zip\Keyfactor
Compress-Archive -Path `
${{ github.workspace }}\${{ inputs.release_dir }}\ `
-DestinationPath ${{ github.workspace }}\zip\Keyfactor\$Env:REPO_NAME.zip -Force
- name: Upload Release Asset (x64)
$platforms = "${{ env.release_platforms }}".Split(';')
$outputDir = "${{ github.workspace }}\zip\Keyfactor"
echo "outputDir=$outputDir" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
if (Test-Path $outputDir) {
Remove-Item -Recurse -Force $outputDir
}
md $outputDir
foreach ($platform in $platforms) {
$sourcePath = "${{ github.workspace }}\${{ inputs.release_dir }}\$platform\"
$zipPath = "$outputDir\${{ env.REPO_NAME }}_$platform.zip"
Get-ChildItem -File -Path $sourcePath
Compress-Archive -Path $sourcePath -DestinationPath $zipPath -Force -Verbose
}
Get-ChildItem -File -Path $outputDir
$buildFiles = Get-ChildItem -File -Path $outputDir -Name
$releaseArtifacts
foreach ($zipFile in $buildFiles) {
$releaseArtifacts = $releaseArtifacts + $outputDir + "\" + $zipFile + [Environment]::NewLine
}
echo "release_artifacts: $releaseArtifacts"
echo "Writing in as multiline github env variable"
echo "release_artifacts<<EOF" >> $env:GITHUB_ENV
echo "$releaseArtifacts" >> $env:GITHUB_ENV
echo "EOF" >> $env:GITHUB_ENV
- name: Release Asset(s)
uses: softprops/action-gh-release@v2
if: success() && env.CREATE_RELEASE == 'True'
id: upload-release-asset-x64
uses: keyfactor/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.release_url }}
asset_path: ${{ github.workspace }}\zip\Keyfactor\${{ env.REPO_NAME}}.zip
asset_name: ${{ env.REPO_NAME}}_${{ inputs.release_version }}.zip
asset_content_type: application/zip

- name: Delete Failed Release
if: failure() && env.CREATE_RELEASE == 'True'
id: delete-failed-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete ${{ inputs.release_version }} --yes --cleanup-tag
repository: ${{ github.repository }}
files: |
${{ env.release_artifacts }}
append_body: true
tag_name: ${{ inputs.release_version }}
token: ${{ secrets.token }}

# - name: Delete Failed Release
# if: failure() && env.CREATE_RELEASE == 'True'
# id: delete-failed-release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release delete ${{ inputs.release_version }} --yes --cleanup-tag

15 changes: 8 additions & 7 deletions .github/workflows/starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:

jobs:
call-assign-from-json-workflow:
uses: Keyfactor/actions/.github/workflows/assign-env-from-json.yml@v3
uses: Keyfactor/actions/.github/workflows/assign-env-from-json.yml@dual-platform-without-doctool

call-get-primary-language:
outputs:
Expand Down Expand Up @@ -87,11 +87,12 @@ jobs:
call-dotnet-build-and-release-workflow:
needs: [call-get-primary-language, call-assign-from-json-workflow, call-create-github-release-workflow]
if: needs.call-get-primary-language.outputs.primary_language == 'C#'
uses: keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@v3
uses: keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@ab#67222-3.0-doctool
with:
release_version: ${{ needs.call-create-github-release-workflow.outputs.release_version }}
release_url: ${{ needs.call-create-github-release-workflow.outputs.release_url }}
release_dir: ${{ needs.call-assign-from-json-workflow.outputs.release_dir }}
release_project: ${{ needs.call-assign-from-json-workflow.outputs.release_project }}
integration_type: ${{ needs.call-assign-from-json-workflow.outputs.integration_type }}
secrets:
token: ${{ secrets.token }}
Expand Down Expand Up @@ -129,11 +130,11 @@ jobs:
secrets:
token: ${{ secrets.token }}

call-generate-readme-workflow:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: Keyfactor/actions/.github/workflows/generate-readme.yml@v3
secrets:
token: ${{ secrets.token }}
# call-generate-readme-workflow:
# if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
# uses: Keyfactor/actions/.github/workflows/generate-readme.yml@v3
# secrets:
# token: ${{ secrets.token }}

call-update-catalog-workflow:
needs: call-assign-from-json-workflow
Expand Down

0 comments on commit 389e029

Please sign in to comment.