Skip to content

Commit

Permalink
chore: update GH actions (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawkyZ authored Sep 19, 2024
1 parent ebaa8cf commit 20a7d56
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
17 changes: 10 additions & 7 deletions .github/actions/next-git-tag/patch-manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@ Param(
[Parameter(Mandatory = $true)]
[string]$ManifestPath, # Path to extension.vsixmanifest
[Parameter(Mandatory = $true)]
[string]$PipelineType # Type of pipeline: "preview" or "stable"
[string]$PipelineType, # Type of pipeline: "preview" or "stable"
[Parameter(Mandatory = $true)]
[string]$Version # Extension Version
)

# Load the XML file
[xml]$xml = Get-Content -Path $ManifestPath

# Check the pipeline type, and if it's a release, modify the DisplayName
if ($PipelineType -eq "preview") {
Write-Host "Pipeline is release, appending 'preview' to DisplayName."
Write-Host "Pipeline is release, setting 'preview' to DisplayName."
$displayNameNode = $xml.PackageManifest.Metadata.DisplayName
# Append ' preview' to the existing DisplayName
# Append 'preview' to the existing DisplayName
$displayNameNode = "(Preview) $displayNameNode"
$xml.PackageManifest.Metadata.DisplayName = $displayNameNode
$xml.PackageManifest.Metadata.Preview = "true"
$xml.PackageManifest.Metadata.Identity.SetAttribute("Id", "snyk_visual_studio_plugin_2022_preview.27b810bb-3e15-4b77-8866-e8ea515a6ee6")
Write-Host "Updated DisplayName: $displayNameNode"
Write-Host "Updated Preview: true"
# Save the modified XML back to the file
$xml.Save($ManifestPath)
Write-Host "Manifest file has been updated successfully."
} else {
Write-Host "Pipeline is not preview, no changes made to DisplayName."
}

$xml.PackageManifest.Metadata.Identity.SetAttribute("Version", $Version)
Write-Host "Updated Version to: $Version"
$xml.Save($ManifestPath)
Write-Host "Manifest file has been updated successfully."
16 changes: 5 additions & 11 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ jobs:
with:
fetch-depth: 0

- name: Patch Name for vsix manifest file
id: patch_vsix
shell: pwsh
run: |
& ".\.github\actions\next-git-tag\patch-manifest.ps1" ".\Snyk.VisualStudio.Extension.2022\source.extension.vsixmanifest" "${{ inputs.channel }}"
- name: Calculate next semantic version
shell: pwsh
id: vsix_version
Expand All @@ -44,11 +38,11 @@ jobs:
& ".\.github\actions\next-git-tag\next-git-tag.ps1" time
}
- name: Set VSIX version for 2022
uses: cezarypiatek/VsixVersionAction@1.0
with:
version: ${{ steps.vsix_version.outputs.next-tag }}
vsix-manifest-file: .\Snyk.VisualStudio.Extension.2022\source.extension.vsixmanifest
- name: Patch vsix manifest file
id: patch_vsix
shell: pwsh
run: |
& ".\.github\actions\next-git-tag\patch-manifest.ps1" ".\Snyk.VisualStudio.Extension.2022\source.extension.vsixmanifest" "${{ inputs.channel }}" "${{ steps.vsix_version.outputs.next-tag }}"
- name: Check if secrets exist
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
git push origin main --tags
- name: Publish 2022 extension to Marketplace
uses: cezarypiatek/VsixPublisherAction@0.2
uses: cezarypiatek/VsixPublisherAction@1.1
with:
extension-file: '.\Snyk.VisualStudio.Extension.2022\bin\Release\Snyk.VisualStudio.Extension.vsix'
publish-manifest-file: '.\Snyk.VisualStudio.Extension.2022\vs-publish-preview.json'
Expand Down

0 comments on commit 20a7d56

Please sign in to comment.