diff --git a/.github/workflows/assign-env-from-json.yml b/.github/workflows/assign-env-from-json.yml index 0889566..660f36d 100644 --- a/.github/workflows/assign-env-from-json.yml +++ b/.github/workflows/assign-env-from-json.yml @@ -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 }} @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/dotnet-build-and-release.yml b/.github/workflows/dotnet-build-and-release.yml index c104eeb..81f24d2 100644 --- a/.github/workflows/dotnet-build-and-release.yml +++ b/.github/workflows/dotnet-build-and-release.yml @@ -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 @@ -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) { @@ -88,37 +93,64 @@ 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) { + $platform = $platform.Trim() + $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<> $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 diff --git a/.github/workflows/starter.yml b/.github/workflows/starter.yml index d73a836..2ca11e0 100644 --- a/.github/workflows/starter.yml +++ b/.github/workflows/starter.yml @@ -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: @@ -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 }} @@ -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