[ODS-6561]Update VSIX installer for project templates #848
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
# Licensed to the Ed-Fi Alliance under one or more agreements. | |
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | |
# See the LICENSE and NOTICES files in the project root for more information. | |
name: Pkg EdFi.ProjectTemplates.Installer | |
on: | |
pull_request: | |
branches: [main,'b-v*-patch*','feature-*'] | |
push: | |
branches: [main, 'b-v*-patch*','feature-*'] | |
workflow_dispatch: | |
permissions: read-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
INFORMATIONAL_VERSION: "7.3" | |
BUILD_INCREMENTER: "-839" | |
AZURE_ARTIFACT_URL: "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json" | |
AZURE_ARTIFACT_NUGET_KEY: ${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }} | |
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS : '{"endpointCredentials": [{"endpoint": "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json","password": "${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }}"}]}' | |
CONFIGURATION: "Release" | |
REPOSITORY_DISPATCH_BRANCH: ${{ github.event.client_payload.branch }} | |
HEAD_REF: ${{ GITHUB.HEAD_REF }} | |
REF_NAME: ${{ GITHUB.REF_NAME }} | |
REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Check for Azure token | |
if: ${{ env.REPOSITORY_OWNER == 'Ed-Fi-Alliance-OSS' && env.AZURE_ARTIFACT_NUGET_KEY == '' }} | |
run: | | |
echo "::error::Missing Azure Token" | |
exit 1 | |
- name: Support longpaths | |
run: git config --system core.longpaths true | |
- name: Checkout Ed-Fi-ODS | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS | |
path: Ed-Fi-ODS/ | |
- name: Checkout Ed-Fi-ODS-Implementation | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation | |
path: Ed-Fi-ODS-Implementation/ | |
- name: Setup MSBuild for .NET Framework 4.8 | |
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce #v2.0.0 | |
- name: Cache Nuget packages | |
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj*', '**/configuration.packages.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: update BUILD_INCREMENTER | |
run: | | |
$newRevision = ([int]${{ github.run_number }}) + ([int]${{env.BUILD_INCREMENTER}}) | |
if ($newRevision -lt 0) { | |
$newRevision = 1 | |
echo "BUILD_INCREMENTER=$newRevision">> $env:GITHUB_ENV | |
} | |
shell: powershell | |
- name: Update version number in source.extension.vsixmanifest file | |
working-directory: ./Ed-Fi-ODS/ | |
run: | | |
$BuildCounter = ${{ github.run_number }} | |
$BuildIncrementer = ${{env.BUILD_INCREMENTER}} | |
$InformationalVersion = ${{ env.INFORMATIONAL_VERSION}} | |
$newRevision = ([int]$BuildCounter) + ([int]$BuildIncrementer) | |
$version = "$InformationalVersion.$newRevision" | |
Write-Host "ODS/API Version : $version" | |
$vsixManifestPath = "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/Utilities/VisualStudioProjectTemplates/EdFi.ProjectTemplates.Installer/source.extension.vsixmanifest" | |
$vsixManifestContent = Get-Content $vsixManifestPath -Raw | |
# Use regex to find the first <Identity> tag and extract the Version attribute value | |
$versionRegex = '<Identity[^>]*\sVersion="([^"]+)"' | |
$match = [regex]::Match($vsixManifestContent, $versionRegex) | |
if ($match.Success) { | |
$currentVersion = $match.Groups[1].Value | |
Write-Host "Current Version: $currentVersion" | |
# Update the Version attribute with a new value | |
$newVersion = $version | |
$updatedContent = $vsixManifestContent -replace "$versionRegex", ('<Identity Id="EdFi.ProjectTemplates" Version="{0}"' -f $newVersion) | |
# Write the updated content back to the file | |
$updatedContent | Set-Content $vsixManifestPath | |
Write-Host "Version updated to: $newVersion" | |
} else { | |
Write-Host "Version attribute not found in <Identity> tag." | |
} | |
shell: powershell | |
- name: Restore NuGet packages | |
working-directory: ./Ed-Fi-ODS/ | |
run: msbuild "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/Utilities/VisualStudioProjectTemplates/EdFi.ProjectTemplates.sln" /t:Restore | |
shell: powershell | |
- name: build | |
run: msbuild "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/Utilities/VisualStudioProjectTemplates/EdFi.ProjectTemplates.sln" /p:Configuration=${{ env.CONFIGURATION }} | |
shell: powershell | |
- name: pack using nuget nuspec file | |
working-directory: ./Ed-Fi-ODS/ | |
shell: powershell | |
run: | | |
.\build.githubactions.ps1 pack -Configuration ${{ env.CONFIGURATION }} -InformationalVersion ${{ env.INFORMATIONAL_VERSION}} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -PackageName "EdFi.Suite3.ProjectTemplates.Installer" -NuspecFilePath "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/Utilities/VisualStudioProjectTemplates/EdFi.ProjectTemplates.Installer/EdFi.ProjectTemplates.Installer.nuspec" | |
- name: Install-credential-handler | |
run: iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx" | |
shell: powershell | |
- name: publish | |
working-directory: ./Ed-Fi-ODS/ | |
run: | | |
.\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Suite3.ProjectTemplates.Installer" | |
shell: powershell | |
- name: Upload EdFi.Suite3.ProjectTemplates.Installer Artifacts | |
if: success() | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: NugetPackages.Artifacts | |
path: ${{ github.workspace }}/Ed-Fi-ODS/NugetPackages/*.nupkg |