Skip to content

Getting Started

Marvin Wendt edited this page Jun 1, 2021 · 15 revisions

This is an in-depth tutorial on how to set the template up.

Setting your repository up

If you have advanced experience with GitHub, you can read a summary of this tutorial here.

Creating your repository from the template

To get started with the cli-template, you have to create a repository first.
To do this, you can click the Use this template button, on the top of the site.

image

After that, you have to wait for your repository to be created.

Enable GitHub Pages

By enabling GitHub Pages, a website, containing your generated docs, will be published automatically.

Go to Repository Settings -> Pages and set the source branch to main and the path to /docs.

image

Creating a Personal Access Token

A Personal Access Token is needed, to push new versions.

You can generate a new access token here: https://github.com/settings/tokens

image

You have to set a name, and the scope should include repo.

image

You can click Generate token now.

image

Copy the generated token and save it somewhere, if you want to reuse it for different projects.

Adding the Personal Access Token as a secret to your repository

You have to set the Personal Access Token as a secret in the repository settings, to enable automatic releases.

Go to your Repository Settings -> Secrets -> New repository secret

image

Set the secret name to REPO_ACCESS_TOKEN and paste your secret into the body.

image

Now click on Add secret

Making the first changes in your app

If you finished all the steps above, you can start making some changes in the code now!
You might want to start with removing the template app, by removing the files: /cmd/date.go and /cmd/time.go.
Then you might want to change the description of your app. Do this in /cmd/root.go.
You're now ready for your first release! Don't worry, the first release does not need to contain any functionality, it's just to set up the CI system, and automate further releases.

First release

The first release will not be automated!

To create the very first release, you can click on the release badge in your README.

image

After that, click on Create a new release

image

You will now see the release page.
Set the tag and title to v0.0.1 and hit Publish release

image

You're done! 🎉
You can now start to create your CLI tool!

Further releases

To publish further releases, you just have to change the version in /cmd/root.go and push the change.
Our custom CI-System will do the rest.