Skip to content

Commit

Permalink
Merge pull request #104 from Keyfactor/dual-platform-without-doctool
Browse files Browse the repository at this point in the history
Integrate changes from test/dev branch
  • Loading branch information
fiddlermikey authored Oct 16, 2024
2 parents c5d4b75 + 98b5794 commit c1fcf95
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 31 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
91 changes: 67 additions & 24 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 @@ -120,18 +124,58 @@ jobs:
- name: Check for manifest
if: success() && env.CREATE_RELEASE == 'True' && inputs.integration_type == 'orchestrator'
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 ($targetFrameworks -eq $null) {
$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
$platforms = "${{ env.release_platforms }}".Split(';')
$outputDir = "${{ github.workspace }}\zip\Keyfactor"
echo "outputDir=$outputDir" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
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
# - name: Check for manifest in zip files
# if: success() && env.CREATE_RELEASE == 'True' && inputs.integration_type == 'orchestrator'
# shell: pwsh
# run: |
# $zipFiles = Get-ChildItem -Path "${{ github.workspace }}\zip\Keyfactor" -Filter '*.zip'
# foreach ($zipFile in $zipFiles) {
# $zipPath = $zipFile.FullName
# Write-Host "Checking manifest.json in $zipPath"

# # Extract the list of files in the zip to check for manifest.json
# $zipContent = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
# $manifestExists = $false
# foreach ($entry in $zipContent.Entries) {
# if ($entry.FullName -eq "manifest.json") {
# $manifestExists = $true
# break
# }
# }
# $zipContent.Dispose()

# if (-not $manifestExists) {
# Write-Host "manifest.json not found in $zipPath"
# exit 1
# } else {
# Write-Host "manifest.json found in $zipPath"
# }
# }


# Hardcoded test files with test-orch-mh
# - name: Upload Release Assets
# if: success() && env.CREATE_RELEASE == 'True'
# uses: keyfactor/upload-release-assets@v1
Expand All @@ -143,23 +187,22 @@ jobs:
# asset_name: "test-orch-mh_*.zip"
# asset_content_type: application/zip

- name: Upload Release Asset (x64)
- 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
body_path: ${{ env.outputDir }}\\test-orch-mh_*.zip
repository: keyfactor/test-orch-mh
files: ${{ env.outputDir }}\\test-orch-mh_*.zip
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@dual-platform-without-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 c1fcf95

Please sign in to comment.