Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
outputs:
skip_workflow: ${{ (steps.check_for_changes.outputs.no_changes == 'true' || steps.check_for_changes.outputs.only_changed == 'true') && 'true' || 'false' }}
VERSION_SUFFIX_OVERRIDE: ${{ steps.compute_version_suffix.outputs.VERSION_SUFFIX_OVERRIDE }}
EXTENSION_VERSION_OVERRIDE: ${{ steps.compute_version_suffix.outputs.EXTENSION_VERSION_OVERRIDE }}

steps:
- name: Checkout code
Expand Down Expand Up @@ -58,13 +59,18 @@ jobs:
Write-Host "Computed VERSION_SUFFIX_OVERRIDE=$VERSION_SUFFIX"
"VERSION_SUFFIX_OVERRIDE=$VERSION_SUFFIX" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append -Encoding utf8

$EXTENSION_VERSION = "99.0.$($Env:PR_NUMBER)"
Write-Host "Computed EXTENSION_VERSION_OVERRIDE=$EXTENSION_VERSION"
"EXTENSION_VERSION_OVERRIDE=$EXTENSION_VERSION" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append -Encoding utf8

tests:
uses: ./.github/workflows/tests.yml
name: Tests
needs: [prepare_for_ci]
if: ${{ github.repository_owner == 'microsoft' && needs.prepare_for_ci.outputs.skip_workflow != 'true' }}
with:
versionOverrideArg: ${{ needs.prepare_for_ci.outputs.VERSION_SUFFIX_OVERRIDE }}
extensionVersionOverride: ${{ needs.prepare_for_ci.outputs.EXTENSION_VERSION_OVERRIDE }}

# This job is used for branch protection. It fails if any of the dependent jobs failed
results:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
versionOverrideArg:
required: false
type: string
extensionVersionOverride:
required: false
type: string

jobs:
setup_for_tests:
Expand Down Expand Up @@ -294,6 +297,11 @@ jobs:
run: npm install
- name: Run tests
run: npm test
- name: Override extension version for PR builds
if: ${{ inputs.extensionVersionOverride != '' }}
env:
EXTENSION_VERSION: ${{ inputs.extensionVersionOverride }}
run: npm version "$EXTENSION_VERSION" --no-git-tag-version
- name: Package VSIX
run: npm exec @vscode/vsce -- package --pre-release -o out/aspire-extension.vsix
- name: Upload VSIX
Expand Down
22 changes: 18 additions & 4 deletions extension/Extension.proj
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@

<Error Text="$(_PackageJsonPath) not found. Cannot package the extension." Condition="!Exists('$(_PackageJsonPath)')" />

<!-- Extract version from package.json using Node.js -->
<!-- Extract version from package.json using Node.js (skip when override is provided) -->
<Exec Command="node -p &quot;require('./package.json').version&quot;"
ConsoleToMSBuild="true"
IgnoreStandardErrorWarningFormat="true"
Condition="'$(ExtensionVersionOverride)' == ''"
WorkingDirectory="$(ExtensionSrcDir)">
<Output TaskParameter="ConsoleOutput" PropertyName="_ExtractedVersion" />
</Exec>

<PropertyGroup>
<_EffectiveVersion Condition="'$(ExtensionVersionOverride)' != ''">$(ExtensionVersionOverride)</_EffectiveVersion>
<_EffectiveVersion Condition="'$(ExtensionVersionOverride)' == ''">$(_ExtractedVersion)</_EffectiveVersion>
<_VscodeOutputDir>$(ArtifactsPackagesDir)vscode</_VscodeOutputDir>
<_VsixPath>$(_VscodeOutputDir)\aspire-vscode-$(_ExtractedVersion).vsix</_VsixPath>
<_ManifestPath>$(_VscodeOutputDir)\aspire-vscode-$(_ExtractedVersion).manifest</_ManifestPath>
<_VsixPath>$(_VscodeOutputDir)\aspire-vscode-$(_EffectiveVersion).vsix</_VsixPath>
<_ManifestPath>$(_VscodeOutputDir)\aspire-vscode-$(_EffectiveVersion).manifest</_ManifestPath>
</PropertyGroup>

<!-- Override package.json version if ExtensionVersionOverride is set, saving original first -->
<Copy SourceFiles="$(_PackageJsonPath)" DestinationFiles="$(_PackageJsonPath).bak"
Condition="'$(ExtensionVersionOverride)' != ''" />
<Exec Command="npm version &quot;$(ExtensionVersionOverride)&quot; --no-git-tag-version"
Condition="'$(ExtensionVersionOverride)' != ''"
WorkingDirectory="$(ExtensionSrcDir)" />

<!-- Install dependencies and compile -->
<Exec Command="yarn install" WorkingDirectory="$(ExtensionSrcDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Command="yarn compile" WorkingDirectory="$(ExtensionSrcDir)" IgnoreStandardErrorWarningFormat="true" />
Expand All @@ -37,7 +47,7 @@
IgnoreStandardErrorWarningFormat="true"
WorkingDirectory="$(ExtensionSrcDir)" />

<!--
<!--
VS Code extension signing for marketplace verification:
Generate manifest from the VSIX using vsce. The signing project (signing/signVsix.proj)
will copy this to .signature.p7s and sign it with the VSCodePublisher certificate.
Expand All @@ -47,6 +57,10 @@
IgnoreStandardErrorWarningFormat="true"
WorkingDirectory="$(ExtensionSrcDir)" />

<!-- Restore original package.json if it was overridden -->
<Move SourceFiles="$(_PackageJsonPath).bak" DestinationFiles="$(_PackageJsonPath)"
Condition="Exists('$(_PackageJsonPath).bak')" />

<Message Importance="high" Text="VS Code extension artifacts created in $(_VscodeOutputDir):" />
<Message Importance="high" Text=" VSIX: $(_VsixPath)" />
<Message Importance="high" Text=" Manifest: $(_ManifestPath)" />
Expand Down
Loading