DEV Community


Posted on

Releasing LENNAH

This week we got the chance to learn how to package and release our SSGs. For my release I decided to use conan as my package manager and GitLab as my package repository. In order to make my package I had to do a few steps first, I needed to install conan and cmake so I could run the commands. I already had cmake installed from testing Andrew's SSG so that was nice. Then I had to make a new GitLab account and link it to my GitHub account so I could import my repo over to GitLab.

Steps for packaging and deploying to repo

  1. First I had to create a new Conan recipe.

    $ conan new LennahSSG/1.0.1 -t
  2. Then a package for the recipe.

    $ conan create . LennahSSG/beta
  3. The next step is to add a global remote that will allow conan to connect to your GitLab repository. This step requires you to find your project ID, which can be found in the Settings -> General page of your GitLab repo. It will be near the top of the page beside the repo name.

    $ conan remote add gitlab<project_id>/packages/conan
  4. Once that is done you need to authenticate your connection. You can provide a few different options.

    $ conan user <gitlab_username or deploy_token_username> -r gitlab -p <personal_access_token or deploy_token>
  5. Finally I uploaded the package to the package repository by using the following command:

    $ conan upload LennahSSG/1.0.0@LennahSSG/beta --all --remote:gitlab

It is important to add the --remote:gitlab part otherwise it will go to the default conancenter remote. I had some trouble figuring this out, so this we definitely my "ah ha!" moment. You can also set the gitlab remote as the default instead by using:

$ conan remote add_ref LennahSSG/1.0.0@LennahSSG/beta gitlab
Enter fullscreen mode Exit fullscreen mode

(Obviously replacing LennahSSG with your own project name)

Conan is nice because I didn't have to modify any of my existing files, by running the commands it added any necessary files on its own.

Testing the installation of the package was pretty easy to do, I had my friend Raymond who doesn't have direct experience with C++ or using Conan, but with some programming experience with web development, test the process. All he had to do to add it as a dependency was add a new text file to a project and run a few commands.

  1. He added a 'conanfile.txt' file with the following inside:

  2. Then he ran the following commands:

$ conan remote add gitlab
Enter fullscreen mode Exit fullscreen mode
$ conan install LennahSSG/1.0.0@LennahSSG/beta --remote=gitlab
Enter fullscreen mode Exit fullscreen mode
$ mkdir build && cd build
Enter fullscreen mode Exit fullscreen mode
$ conan install ..
Enter fullscreen mode Exit fullscreen mode
$ cmake .. && cmake --build .
Enter fullscreen mode Exit fullscreen mode

He was able to install LennahSSG as a dependency for his project and could use it in it. You can checkout the package here.

It was an interesting process making a release, I think for future project I would want to try out using other methods as well to see if I find one that I like more or find easier. Because while I did eventually manage to figure out how to create the package with Conan, it was still a bit difficult to figure out how and follow the documentation. It also has a lot of commands you would need to remember, so maybe there are easier options to use. If you want to read more information on how to publish, install, or run packages using conan checkout these docs: publish & install, running. Until next time take care!

Top comments (0)