Skip to content

Commit c5da225

Browse files
committed
Standardization 2.0
1 parent 2fe693f commit c5da225

22 files changed

+288
-187
lines changed

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish to VS Marketplace
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: windows-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: 1. Download artifact
14+
id: download-artifact
15+
uses: dawidd6/action-download-artifact@v2
16+
with:
17+
github_token: ${{ secrets.GH_SECRET }}
18+
workflow: release_build_and_deploy.yml
19+
workflow_conclusion: success
20+
21+
- name: 2. Parse Artifact Manifest
22+
id: artifact_manifest
23+
uses: ActionsTools/read-json-action@main
24+
with:
25+
file_path: ./artifact/CodingWithCalvin.GitKraken.info
26+
27+
- name: 3. Create Tag & Release
28+
uses: ncipollo/[email protected]
29+
with:
30+
artifacts: ./artifact/CodingWithCalvin.GitKraken.vsix
31+
generateReleaseNotes: true
32+
makeLatest: true
33+
token: ${{ secrets.GH_SECRET }}
34+
commit: ${{ steps.artifact_manifest.outputs.sha }}
35+
tag: ${{ steps.artifact_manifest.outputs.version }}
36+
37+
- name: 4. Publish Release to Marketplace
38+
if: success()
39+
uses: CodingWithCalvin/GHA-VSMarketplacePublisher@v1
40+
with:
41+
marketplace-pat: ${{ secrets.VS_PAT }}
42+
publish-manifest-path: ./resources/extension.manifest.json
43+
vsix-path: ./artifact/CodingWithCalvin.GitKraken.vsix
44+
45+

.github/workflows/release_build_and_deploy.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,45 @@ name: 'Build and Deploy'
22

33
on:
44
workflow_dispatch:
5+
pull_request:
6+
types: [opened, reopened]
57
push:
6-
branches: main
8+
branches:
9+
- main
10+
tags-ignore:
11+
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'
712

813
jobs:
914
Release-Build-and-Deploy:
1015
runs-on: windows-latest
1116

1217
steps:
13-
- uses: actions/checkout@v3
14-
- uses: microsoft/[email protected]
15-
18+
- uses: actions/checkout@v4
19+
- uses: microsoft/setup-msbuild@v2
20+
- uses: nuget/setup-nuget@v2
21+
1622
- name: 1. Versioning Release
17-
uses: CalvinAllen/action-vs-vsix-versioner@v1
23+
id: step-version
24+
uses: CodingWithCalvin/GHA-VSVsixVersioner@v1
1825
with:
19-
extension-manifest-file: './src/CodingWithCalvin.VSKraken/source.extension.vsixmanifest'
20-
extension-source-file: './src/CodingWithCalvin.VSKraken/source.extension.cs'
26+
extension-manifest-file: 'src/CodingWithCalvin.GitKraken/source.extension.vsixmanifest'
27+
extension-source-file: 'src/CodingWithCalvin.GitKraken/source.extension.cs'
2128

22-
- name: 2. Bootstrapping NuGet Installer
23-
uses: nuget/[email protected]
24-
25-
- name: 3. Restoring Packages
26-
run: nuget restore ./src/CodingWithCalvin.VSKraken.sln
29+
- name: 2. Restoring Packages
30+
run: nuget restore src/CodingWithCalvin.GitKraken.sln
2731

28-
- name: 4. Building x64 Project
29-
run: msbuild './src/CodingWithCalvin.VSKraken/CodingWithCalvin.VSKraken.csproj' /p:configuration='Release' /p:platform='x64'
32+
- name: 3. Building Project
33+
run: msbuild 'src/CodingWithCalvin.GitKraken/CodingWithCalvin.GitKraken.csproj' /p:configuration='Release' /p:platform='x64' /p:DeployExtension=False
3034

31-
- name: 5. Publishing x64 Build Artifact
32-
uses: actions/upload-artifact@v3
35+
- name: 4. Create Information File
36+
uses: jsdaniell/[email protected]
37+
with:
38+
name: 'src/CodingWithCalvin.GitKraken/bin/x64/Release/CodingWithCalvin.GitKraken.info'
39+
json: '{"sha":"${{ github.sha }}", "version":"${{ steps.step-version.outputs.version }}"}'
40+
41+
- name: 5. Publishing Build Artifact
42+
uses: actions/upload-artifact@v4
3343
with:
34-
path: '${{ github.workspace }}\src\CodingWithCalvin.VSKraken\bin\x64\Release\CodingWithCalvin.VSKraken.vsix'
35-
name: latest-x64
44+
path: |
45+
src/CodingWithCalvin.GitKraken/bin/x64/Release/CodingWithCalvin.GitKraken.info
46+
src/CodingWithCalvin.GitKraken/bin/x64/Release/CodingWithCalvin.GitKraken.vsix

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ A Visual Studio extension that adds a right-click context menu (on the solution
44

55
## License
66

7-
[![License - MIT](https://img.shields.io/github/license/CalvinAllen/VSKraken?style=for-the-badge)](https://img.shields.io/github/license/CalvinAllen/VSKraken?style=for-the-badge)
7+
[![License - MIT](https://img.shields.io/github/license/CodingWithCalvin/VS-GitKraken?style=for-the-badge)](https://img.shields.io/github/license/CodingWithCalvin/VS-GitKraken?style=for-the-badge)
88

99
## Build Status
1010

11-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/CalvinAllen/VSKraken/Build%20and%20Deploy?logo=github&style=for-the-badge)](https://img.shields.io/github/workflow/status/CalvinAllen/VSKraken/Build%20and%20Deploy?logo=github&style=for-the-badge)
11+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/CodingWithCalvin/VS-GitKraken/Build%20and%20Deploy?logo=github&style=for-the-badge)](https://img.shields.io/github/workflow/status/CodingWithCalvin/VS-GitKraken/Build%20and%20Deploy?logo=github&style=for-the-badge)
1212

1313
## Marketplace Status
1414

15-
[![Marketplace Installations](https://img.shields.io/visual-studio-marketplace/i/coding-with-calvin.VSKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/i/coding-with-calvin.VSKraken?style=for-the-badge) [![Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/coding-with-calvin.VSKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/d/coding-with-calvin.VSKraken?style=for-the-badge)
16-
[![Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/coding-with-calvin.VSKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/v/coding-with-calvin.VSKraken?style=for-the-badge) [![Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/coding-with-calvin.VSKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/r/coding-with-calvin.VSKraken?style=for-the-badge)
15+
[![Marketplace Installations](https://img.shields.io/visual-studio-marketplace/i/CodingWithCalvin.VS-GitKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/i/CodingWithCalvin.VS-GitKraken?style=for-the-badge) [![Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/CodingWithCalvin.VS-GitKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/d/CodingWithCalvin.VS-GitKraken?style=for-the-badge)
16+
[![Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/CodingWithCalvin.VS-GitKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/v/CodingWithCalvin.VS-GitKraken?style=for-the-badge) [![Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/CodingWithCalvin.VS-GitKraken?style=for-the-badge)](https://img.shields.io/visual-studio-marketplace/r/CodingWithCalvin.VS-GitKraken?style=for-the-badge)
1717

1818
## Prerequisite
1919

20-
In order to use this extension, you must have Visual Studio 2022, as well as the GitKraken Client installed.
20+
In order to use this extension you must have the GitKraken Client installed.
2121

2222
You can [download the GitKraken Client for free](https://www.gitkraken.com).
2323

@@ -27,4 +27,6 @@ The extension will automatically find GitKraken's `Update.exe` when it's located
2727

2828
## Contribute
2929

30+
Contributions are welcome! Issues, PRs, etc. While it may seem this extension is "done", who knows what the future may hold for it?
31+
3032
For cloning and building this project yourself, make sure to install the [Extensibility Essentials 2022 extension](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ExtensibilityEssentials2022) for Visual Studio which enables some features used by this project.

resources/extension.manifest.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "http://json.schemastore.org/vsix-publish",
3+
"categories": [
4+
"coding",
5+
"other",
6+
"programming languages"
7+
],
8+
"identity": {
9+
"internalName": "VS-GitKraken"
10+
},
11+
"overview": "../README.md",
12+
"publisher": "CodingWithCalvin"
13+
}

src/CodingWithCalvin.GitKraken.sln

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1F627943-1FB0-49C1-A11D-A79007BA37E1}"
7+
ProjectSection(SolutionItems) = preProject
8+
..\resources\extension.manifest.json = ..\resources\extension.manifest.json
9+
..\.github\workflows\publish.yml = ..\.github\workflows\publish.yml
10+
..\README.md = ..\README.md
11+
..\.github\workflows\release_build_and_deploy.yml = ..\.github\workflows\release_build_and_deploy.yml
12+
EndProjectSection
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodingWithCalvin.GitKraken", "CodingWithCalvin.GitKraken\CodingWithCalvin.GitKraken.csproj", "{1BC1A40B-9AB4-4A8F-914C-097660B9F084}"
15+
EndProject
16+
Global
17+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18+
Debug|arm64 = Debug|arm64
19+
Debug|x64 = Debug|x64
20+
Debug|x86 = Debug|x86
21+
Release|arm64 = Release|arm64
22+
Release|x64 = Release|x64
23+
Release|x86 = Release|x86
24+
EndGlobalSection
25+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Debug|arm64.ActiveCfg = Debug|arm64
27+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Debug|arm64.Build.0 = Debug|arm64
28+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Debug|x64.ActiveCfg = Debug|x64
29+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Debug|x64.Build.0 = Debug|x64
30+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Debug|x86.ActiveCfg = Debug|x86
31+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Debug|x86.Build.0 = Debug|x86
32+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Release|arm64.ActiveCfg = Release|arm64
33+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Release|arm64.Build.0 = Release|arm64
34+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Release|x64.ActiveCfg = Release|x64
35+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Release|x64.Build.0 = Release|x64
36+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Release|x86.ActiveCfg = Release|x86
37+
{1BC1A40B-9AB4-4A8F-914C-097660B9F084}.Release|x86.Build.0 = Release|x86
38+
EndGlobalSection
39+
GlobalSection(SolutionProperties) = preSolution
40+
HideSolutionNode = FALSE
41+
EndGlobalSection
42+
GlobalSection(ExtensibilityGlobals) = postSolution
43+
SolutionGuid = {116BC4C5-8048-4740-98D0-F2C829BC1D7C}
44+
EndGlobalSection
45+
EndGlobal

src/CodingWithCalvin.VSKraken/CodingWithCalvin.VSKraken.csproj renamed to src/CodingWithCalvin.GitKraken/CodingWithCalvin.GitKraken.csproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<ProjectGuid>{1BC1A40B-9AB4-4A8F-914C-097660B9F084}</ProjectGuid>
1414
<OutputType>Library</OutputType>
1515
<AppDesignerFolder>Properties</AppDesignerFolder>
16-
<RootNamespace>CodingWithCalvin.VSKraken</RootNamespace>
17-
<AssemblyName>CodingWithCalvin.VSKraken</AssemblyName>
16+
<RootNamespace>CodingWithCalvin.GitKraken</RootNamespace>
17+
<AssemblyName>CodingWithCalvin.GitKraken</AssemblyName>
1818
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1919
<GeneratePkgDefFile>true</GeneratePkgDefFile>
2020
<UseCodebase>true</UseCodebase>
@@ -63,9 +63,13 @@
6363
<DesignTime>True</DesignTime>
6464
<DependentUpon>VSCommandTable.vsct</DependentUpon>
6565
</Compile>
66-
<Compile Include="VSKrakenPackage.cs" />
66+
<Compile Include="GitKrakenPackage.cs" />
6767
</ItemGroup>
6868
<ItemGroup>
69+
<Content Include="..\..\LICENSE">
70+
<Link>resources\LICENSE</Link>
71+
<IncludeInVSIX>true</IncludeInVSIX>
72+
</Content>
6973
<None Include="source.extension.vsixmanifest">
7074
<SubType>Designer</SubType>
7175
<Generator>VsixManifestGenerator</Generator>
@@ -84,24 +88,20 @@
8488
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5232" />
8589
</ItemGroup>
8690
<ItemGroup>
87-
<Resource Include="Resources\context-menu-icon.png" />
8891
<VSCTCompile Include="VSCommandTable.vsct">
8992
<ResourceName>Menus.ctmenu</ResourceName>
9093
<Generator>VsctGenerator</Generator>
9194
<LastGenOutput>VSCommandTable.cs</LastGenOutput>
9295
</VSCTCompile>
9396
</ItemGroup>
97+
<ItemGroup />
9498
<ItemGroup>
95-
<Content Include="Resources\LICENSE.txt">
96-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
97-
<IncludeInVSIX>true</IncludeInVSIX>
98-
</Content>
99-
<Content Include="Resources\manifest-icon.png">
100-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
99+
<Content Include="..\..\resources\context-menu-icon.png">
100+
<Link>resources\context-menu-icon.png</Link>
101101
<IncludeInVSIX>true</IncludeInVSIX>
102102
</Content>
103-
<Content Include="Resources\manifest-preview.png">
104-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
103+
<Content Include="..\..\resources\manifest-icon.png">
104+
<Link>resources\manifest-icon.png</Link>
105105
<IncludeInVSIX>true</IncludeInVSIX>
106106
</Content>
107107
</ItemGroup>

src/CodingWithCalvin.VSKraken/Commands/OpenCommand.cs renamed to src/CodingWithCalvin.GitKraken/Commands/OpenCommand.cs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using Microsoft.VisualStudio.Shell;
2-
using System;
1+
using System;
32
using System.ComponentModel.Design;
43
using System.Diagnostics;
5-
using EnvDTE80;
6-
using EnvDTE;
74
using System.Windows.Forms;
8-
using CodingWithCalvin.VSKraken.Helpers;
9-
using CodingWithCalvin.VSKraken.Dialogs;
5+
using CodingWithCalvin.GitKraken.Dialogs;
6+
using CodingWithCalvin.GitKraken.Helpers;
7+
using EnvDTE;
8+
using EnvDTE80;
9+
using Microsoft.VisualStudio.Shell;
1010

11-
namespace CodingWithCalvin.VSKraken.Commands
11+
namespace CodingWithCalvin.GitKraken.Commands
1212
{
1313
internal class OpenCommand
1414
{
@@ -23,11 +23,15 @@ private OpenCommand(Package package, SettingsDialogPage settings)
2323
this._package = package;
2424
this._settings = settings;
2525

26-
var commandService = (OleMenuCommandService)ServiceProvider.GetService(typeof(IMenuCommandService));
26+
var commandService = (OleMenuCommandService)
27+
ServiceProvider.GetService(typeof(IMenuCommandService));
2728

2829
if (commandService != null)
2930
{
30-
var menuCommandId = new CommandID(PackageGuids.guidOpenInGKCmdSet, PackageIds.OpenInGK);
31+
var menuCommandId = new CommandID(
32+
PackageGuids.guidOpenInGKCmdSet,
33+
PackageIds.OpenInGK
34+
);
3135
var menuItem = new MenuCommand(OpenPath, menuCommandId);
3236
commandService.AddCommand(menuItem);
3337
}
@@ -48,13 +52,18 @@ private void OpenPath(object sender, EventArgs e)
4852
var gitRepository = ProjectHelpers.GetSelectedPath(service);
4953
var gitkrakenUpdateExecutablePath = _settings.UpdateExecutablePath;
5054

51-
if (!string.IsNullOrEmpty(gitRepository) && !string.IsNullOrEmpty(gitkrakenUpdateExecutablePath))
55+
if (
56+
!string.IsNullOrEmpty(gitRepository)
57+
&& !string.IsNullOrEmpty(gitkrakenUpdateExecutablePath)
58+
)
5259
{
5360
OpenExecutable(gitRepository, gitkrakenUpdateExecutablePath);
5461
}
5562
else
5663
{
57-
MessageBox.Show("Unable to find a compatible git repository for the selected solution.");
64+
MessageBox.Show(
65+
"Unable to find a compatible git repository for the selected solution."
66+
);
5867
}
5968
}
6069
catch (Exception ex)
@@ -63,13 +72,17 @@ private void OpenPath(object sender, EventArgs e)
6372
}
6473
}
6574

66-
private static void OpenExecutable(string gitRepository, string gitkrakenUpdateExecutablePath)
75+
private static void OpenExecutable(
76+
string gitRepository,
77+
string gitkrakenUpdateExecutablePath
78+
)
6779
{
6880
var startInfo = new ProcessStartInfo
6981
{
7082
WorkingDirectory = gitRepository,
7183
FileName = $@"{gitkrakenUpdateExecutablePath}",
72-
Arguments = $@"--processStart=gitkraken.exe --process-start-args=""-p ""{ gitRepository }""",
84+
Arguments =
85+
$@"--processStart=gitkraken.exe --process-start-args=""-p ""{gitRepository}""",
7386
CreateNoWindow = true,
7487
WindowStyle = ProcessWindowStyle.Hidden,
7588
UseShellExecute = false
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.IO;
4+
using Microsoft.VisualStudio.Shell;
5+
6+
namespace CodingWithCalvin.GitKraken.Dialogs
7+
{
8+
public class SettingsDialogPage : DialogPage
9+
{
10+
[Category("General")]
11+
[DisplayName("GitKraken Installation Path")]
12+
[Description(
13+
"The absolute path to GitKraken's \"Update.exe\" file, including the executable."
14+
)]
15+
public string UpdateExecutablePath { get; set; }
16+
17+
public override void LoadSettingsFromStorage()
18+
{
19+
base.LoadSettingsFromStorage();
20+
21+
if (!string.IsNullOrEmpty(this.UpdateExecutablePath))
22+
{
23+
return;
24+
}
25+
26+
this.UpdateExecutablePath = FindGitKrakenInstallDirectory();
27+
}
28+
29+
private static string FindGitKrakenInstallDirectory()
30+
{
31+
var directoryInfo = new DirectoryInfo(
32+
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
33+
);
34+
35+
foreach (var directory in directoryInfo.GetDirectories("gitkraken"))
36+
{
37+
var path = Path.Combine(directory.FullName, "Update.exe");
38+
if (File.Exists(path))
39+
{
40+
return path;
41+
}
42+
}
43+
44+
return null;
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)