-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ROAD-641] Fix: deployment pipeline for vs (#102)
* chore: introduce local action * chore: combine releasing into one workflow step * chore: add version prefix for 2022 vsix file when uploading to releases * chore: incorporate changes from review Co-authored-by: Pavel Sorokin <[email protected]>
- Loading branch information
1 parent
edef85a
commit aefb46b
Showing
5 changed files
with
108 additions
and
137 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: 'Get Next SemVer Tag' | ||
description: 'Get next Git tag in semver format' | ||
outputs: | ||
next-tag: | ||
description: 'next Git tag in semver format' | ||
value: ${{ steps.get-next-semver-tag.outputs.next-tag }} | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- id: get-next-semver-tag | ||
run: ${{ github.action_path }}/next-git-tag.ps1 | ||
shell: pwsh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<# | ||
.SYNOPSIS | ||
This script calculates a next Git tag in SemVer format. | ||
#> | ||
[CmdletBinding()] | ||
Param() | ||
|
||
[string[]]$AllTags = (git tag --sort=committerdate) | ||
Write-Verbose "all tags: $AllTags" | ||
$LatestTag = $AllTags[$AllTags.Length - 1] | ||
Write-Host "Found latest Git tag: $LatestTag" | ||
|
||
# split the tag by dots and increment patch version | ||
$v = $LatestTag -split "\." | ||
[string] $MajorStr = $v[0] | ||
[int] $Major = 0 | ||
if ($MajorStr.StartsWith("v")) | ||
{ | ||
$Major = $MajorStr.Substring(1) | ||
} | ||
else | ||
{ | ||
$Major = $MajorStr | ||
} | ||
[int] $Minor = $v[1] | ||
[int] $Patch = $v[2] | ||
|
||
Write-Verbose "MAJOR part: $Major" | ||
Write-Verbose "MINOR part: $Minor" | ||
Write-Verbose "PATCH part: $Patch" | ||
|
||
# hardcoded increment for patch | ||
$Patch += 1; | ||
|
||
$NextSemverTag = "$Major.$Minor.$Patch" | ||
Write-Host "Next SemVer tag: $NextSemverTag" | ||
|
||
# Return next tag to workflow | ||
echo "::set-output name=next-tag::$NextSemverTag" |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,17 +24,16 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.config') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: '.\Snyk.Common\appsettings.json' | ||
|
@@ -55,54 +54,80 @@ jobs: | |
- name: Restore NuGet packages | ||
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | ||
|
||
- name: Increment VSIX version | ||
- name: Calculate next semantic version Git tag (vsix version) | ||
id: vsix_version | ||
uses: timheuer/vsix-version-stamp@v1 | ||
uses: ./.github/actions/next-git-tag -Verbose | ||
|
||
- name: Set VSIX version for 2015-2019 | ||
uses: cezarypiatek/[email protected] | ||
with: | ||
manifest-file: ${{ env.VsixManifestPath }} | ||
|
||
- name: Set up Git actions user | ||
uses: fregante/setup-git-user@v1 | ||
|
||
- name: Commit new version | ||
run: | | ||
git commit -am 'increment new version' | ||
git tag ${{ steps.vsix_version.outputs.version-number }} | ||
git push origin main | ||
git push origin main --tags | ||
version: ${{ steps.vsix_version.outputs.next-tag }} | ||
vsix-manifest-file: .\Snyk.VisualStudio.Extension\source.extension.vsixmanifest | ||
|
||
- name: Set VSIX version for 2022 | ||
uses: cezarypiatek/[email protected] | ||
with: | ||
version: ${{ steps.vsix_version.outputs.next-tag }} | ||
vsix-manifest-file: .\Snyk.VisualStudio.Extension.2022\source.extension.vsixmanifest | ||
|
||
- name: Build | ||
run: | | ||
msbuild ${{env.SOLUTION_FILE_PATH}} /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m | ||
shell: powershell | ||
|
||
- name: Tests | ||
run: vstest.console.exe **\*.Tests.dll | ||
|
||
- name: Create Release | ||
|
||
- name: Set up Git actions user | ||
uses: fregante/setup-git-user@v1 | ||
|
||
- name: Create and push Git tag release | ||
run: | | ||
git tag ${{ steps.vsix_version.outputs.next-tag }} | ||
git push origin main | ||
git push origin main --tags | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.vsix_version.outputs.version-number }} | ||
release_name: Release ${{ steps.vsix_version.outputs.version-number }} | ||
tag_name: ${{ steps.vsix_version.outputs.next-tag }} | ||
release_name: Release ${{ steps.vsix_version.outputs.next-tag }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
|
||
- name: Upload GitHub Release 2015-2019 Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: .\Snyk.VisualStudio.Extension\bin\Release\Snyk.VisualStudio.Extension.vsix | ||
asset_name: Snyk_Vulnerability_Scanner-${{ steps.vsix_version.outputs.version-number }}.vsix | ||
asset_name: Snyk_Vulnerability_Scanner-${{ steps.vsix_version.outputs.next-tag }}.vsix | ||
asset_content_type: application/zip | ||
|
||
|
||
- name: Upload GitHub Release 2022 Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: .\Snyk.VisualStudio.Extension.2022\bin\Release\Snyk.VisualStudio.Extension.vsix | ||
asset_name: Snyk_Vulnerability_Scanner-${{ steps.vsix_version.outputs.next-tag }}-2022.vsix | ||
asset_content_type: application/zip | ||
|
||
- name: Publish 2015-2019 extension to Marketplace | ||
uses: cezarypiatek/[email protected] | ||
with: | ||
extension-file: '.\Snyk.VisualStudio.Extension\bin\Release\Snyk.VisualStudio.Extension.vsix' | ||
publish-manifest-file: '.\Snyk.VisualStudio.Extension\vs-publish.json' | ||
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} | ||
|
||
- name: Publish 2022 extension to Marketplace | ||
uses: cezarypiatek/[email protected] | ||
with: | ||
extension-file: '.\Snyk.VisualStudio.Extension.2022\bin\Release\Snyk.VisualStudio.Extension.vsix' | ||
publish-manifest-file: '.\Snyk.VisualStudio.Extension.2022\vs-publish.json' | ||
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} |