Create GitHub release using CloudBuild - github

I have everyting automated with CloudBuild and additionally I'd like to create a GitHub release using the CloudBuild. In short, I prepare binary files and then I want to create a GitHub release using those files.
I cannot find any working example. What should the appropriate step look like?
Additionally, I'm not sure about the authentication between GitHub <-> CloudBuild.

You can refer to the Documentation (click GitHub cli tab) where
how to create a release using CLI is explained stepwise.
There is also a separated command Doc for how to add files to
the release.
To use Github Cli in cloud build , the best Practice would be to use
community builder , for more information how to use it you can refer
to the Documentation where Readme contains a more detailed
view.
For more information, you can visit to the Public Documentation where it is mentioned as :
This page explains how to use community-contributed builders and
custom builders in Cloud Build. The Cloud Build developer community
provides open-source builders that you can use to execute your
tasks. If the task you want to perform requires capabilities that are
not provided by an existing image, you can build your own custom image
and use it in a build step. To learn about the different types of
builders, see Cloud Builders.

Related

Is there a way to migrate a project board in GitHub to project (beta)?

I have an existing project that uses project boards on GitHub. I want to move all issues (open and closed) to projects (beta) on GitHub. Is there a way to do that automatically? Right now, I only know how to add issues manually to projects (beta).
As far as I know, there is currently no official guide on how to migrate to GitHub Projects (beta). You might want to follow this discussion on the topic: https://github.com/github/feedback/discussions/6141
However, I created a tutorial on how to migrate from the legacy project boards to the new projects (beta) myself: https://github.com/galargh/projects-migration#how-to-migrate-from-github-projects-to-github-projects-beta
It describes how to migrate cards (including column names) by either running a GitHub Actions workflow or a bash script.
Unfortunately, it does require some manual steps because projects (beta) API is not complete yet - the project itself and the Status field options have to be created manually to be precise.
After the migration, I'm also heavily using this action I created https://github.com/protocol/github-api-action-library/tree/master/add-project-items-by-content-query. I use it to periodically populate my projects based on content search queries (e.g. I automated adding all the issues that mention me - https://github.com/galargh/.github/blob/684c316/.github/workflows/add-project-items.yml).
I implemented python script that helps you migrate your project (similar to #galargh's solution) which uses the GraphQL api for the old projects too (might be more future proof) and also allows you to map column names and migrate PRs.
https://github.com/doidor/gh-projects-migration
You can now do this by enabling the Project migration feature in feature preview
Once you enable it you should see a Start migration button when you go to your Classic (not beta) Project Board
Here are the official docs on how to do it

How to release on GitHub through the command line and to attach a large file?

Is it possible to release on GitHub through the command line with an attached file that is not pushed to a repository?
I have a file over 1GB that I easily attached through a web GitHub release page, but I want to automate that using bash.
You can from command-line, using gh: cli/cli/
create a relase
gh release create <tag> [<files>...] [flags]
upload a file to that release
gh release upload <tag> <files>... [flags]
And since Github CLI 2.4.0 (Dec. 2021), you have:
the non-interactive flag --generate-notes, which allows you to skip the editor phase.
an interactive mode to choose a tag name
There's a REST API that can be used for this purpose. It's used to upload a release asset if you know the ID for the release (which you can get by querying the release itself). You can also get the upload URL by querying the release using a GET request; that returns the upload_url attribute.
If you want an example of how to do this from the command line with curl, Git LFS has a script that it uses to do releases and upload assets which you could look at. It's a little complex, but it is reasonably comprehensive.
In addition to the gh tool and directly using the REST API (as mentioned in other answers), there are several command-line tools which let you create and manipulate GitHub releases. These are likely to be much simpler to use than directly using the REST API.
There is only one* I could identify that I could unreservedly recommend, however: github-release, which is written in Go. Binaries can be downloaded from the project's Releases page, it "dogfoods (transparently uses its own tool), and is actively maintained (as at January 2022).
Some others are:
Another Go app called github-release, released by BuildKite. However, this seems to be less actively maintained, and it doesn't transparently "dogfood" (viewing its CI results require an account with BuildKite).
For Haskell developers, there's yet another tool called github-release, created by Taylor Fausak. It seems to be actively maintained; however, no downloadable executables are provided, so you must build it yourself using a Haskell compiler and build tools.
For node.js developers, there's release-it; but as a node project, it doesn't provide executable binaries that could be invoked from Bash at all.
*If there are others that I've missed, feel free to add them in comments.

How can you convert a GitHub action that uses Docker images into Azure Pipelines custom task

I'm trying to create a custom task to be published on the Azure Pipelines Marketplace so that people can use my security tool within Azure Pipelines. The task requires a lot of additional software, so Docker has been used for packaging.
I've similarly created the action for GitHub Actions, https://github.com/tonybaloney/pycharm-security/blob/master/action.yml
The action will-
Use a custom Docker image (hosted on Docker Hub)
Mount the code after checkout
Run a custom entry point, passing the arguments provided to the action
I cannot see how to achieve the same thing in Azure Pipelines. All of the example code for custom tasks is written in TS/Node or PowerShell.
The only TS/Node.js example doesn't show you how to do anything like download a docker image and run it.
The only other documentation I can find is about how to build a Docker image from within a Pipeline. But I want to download and run an image as a Task.
The Task SDK documentation clearly shows how to construct the package, but not how to do anything beyond getting it to pass arguments.
One possibility is to clone the DockerV2 Task and to customize it to run the Docker commands that I need, but this seems quite convoluted compared with how simple it is in GitHub Actions
How can you convert a GitHub action that uses Docker images into Azure Pipelines custom task
I am afraid you have to clone the DockerV2 Task and to customize it to run the Docker commands that you need.
The reason for its complexity is that their implementation forms are different.
We are customizing github action and publishing to Marketplace, the custom github action did not compile and package the source code, but just quoted the original code. In other words, our custom action is more like providing a link to tell the compiler where to download the source code and pass parameters and rewrite the source code. So we don't need to download the source code of github action and customize it.
However, the Azure Pipelines custom task is different. The custom task needs to be compiled to generate a .visx file, which requires the source code and compiles it after rewriting.
Besides, Azure devops provide a Task groups, so that we could encapsulate a sequence of tasks, already defined in a build or a release pipeline, into a single reusable task that can be added to a build or release pipeline, just like any other task. You can choose to extract the parameters from the encapsulated tasks as configuration variables, and abstract the rest of the task information.
Hope this helps.

How can I publish the vscode plugin in vscode marketplace using API?

My goal is to publish a extension in vscode marketplace without manually interact. Can someone make me aware, whether I can use extension API for this or there is another way using curl option?
You can use the vsce CLI. With this you can publish and update an extension from command line. Therefore you should be capable to automate that process in a CI/CD pipeline. There is also an article in the docs that explains how to use the tool.
Optionally, you can take a look to one of my extensions. There I automatically create releases using azure pipelines.

How to rename artifact on rest api build promotion

I am relatively new to artifactory trying to achieve the below pointers.
1.) After QA approval trying to promote Jars from snapshot to release artifact(actual promotion works) but promoting to release artifact is not changing version name.
whether it is possible to change/rename artifact on rest api build promotion.?
2.) Also please suggest how we can achieve roll-back scenarios here.
Any inputs are greatly appreciated.
Thanks.
The build promotion REST API does support changing the version name.enter link description here
You can change the version name using a custom promotion user plugin. You can see some examples of build promotion plugins in the JFrog Dev Github account.
Specifically, the promotion.groovy plugin contains example of copying staging artifacts to release artifacts.
A good place to start is the user plugins wiki page and the Artifactory public API documentation.
The Artifactory Jenkins plugin supports more advanced release management capabilities, including the option to rollback.