GitHub action flow for publishing the Vs-code plugin

Sumudu Nissanka
4 min readSep 8, 2020
GitHub Actions image -01— https://github.com/actions/upload-artifact

Hi folks , after having a long time period I came to you with this article. Hope you guys may enjoy this. Are you willing to automate, customize and execute your software development workflow ? this is for you : )

Before moving to our main topic, I would like to give you some general sense of the definition of GitHub Action Flow.

What is GitHub Action?

Version controlling in the software project is a necessary task for software developers. Using GitHub we can track our progress and we can clearly manage our contribution with other developers. In 2018 GitHub gave more than just that to the developers. It introduces the GitHub Action flow for developers.

Basically, GitHub Actions enables you to create individual tasks for automating your action flow with the system. You can trigger the action with simple release a new version of project [Continuous Deployment], apply some push to some changes to branch automated, automate the testing process before your code merged the repository [Continuous Integration] and handle the cron job (background schedule jobs) in your workflows. Because of this immense automation ability DevOps Engineers got used to having GitHub action workflows for their production CI/CD.

Now coming to the general purpose of this article, I’m ready to make you aware how to create a simple workflow to publish your VScode plugin to VScode marketplace.

If we talk about the repository structure, we write our workflow in the file with the yaml extension. These workflow files are placed on the path .github/workflows folder in your repository. You can externally push yaml workflows to this folder or you can code your workflow with the GitHub workflow UI (image-02).

image-02 GitHub UI for workflows

Before publishing the extension to the marketplace you need to create an account in Microsoft and take relevant secret keys for publishing the extensions. Through this link you can have a clear idea about how to publish a VScode plugin in the market place manually (publishing vscode extension to marketplace). Our task is to convert these manual steps to an automated way using our GitHub workflow.

workflow sample code

Reviewing the workflow code , We make the released type as a published for triggering our workflow(lines 1–3). When you go through the sample workflow code, you can see that we make our authentication key as a secret key in GitHub.

Upper part of the workflow we checked out to our workplace and made our working environment as we required.We set up the python version as version 3 because our rest of the process is compatible with version 3.

We used VS Code VSCE GitHub Action plugin to process all the steps in the publishing tasks. You can see in line numbers 19–24, we are removing the previous plugin from the marketplace. It is not necessary, here we used it to avoid the conflict with the same plugin publication multiple times.

Most important part is with lines 26–31. This is the main process we are going to do. In line 29 we gave a path to the vsix file that used to be published in the marketplace. You can wget the vsix file from your external place to Workflow without accessing it within the repository.

This is all about the simple workflow for publishing your extension to vscode marketplace . Now developers, DevOps engineers no need to worrying about publishing the product extension by manually. because GitHub gives the supper cool solution with action flows when publishing your any extensions to any marketplace at same time your release happening.

Hope you guys have some cool idea form this article to work productive way with your production. Happy reading :) thank you all….:)

References

--

--

Sumudu Nissanka

Software Engineer @wso2 | Graduate @University of Colombo School of Computing | Former DevOps intern @wso2