» Publishing your VL nugets with Github Actions
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Publishing your VL nugets with Github Actions

bonjourbonjour,

Following tests from a few months ago regarding publishing your shiny VL nugets with Github Actions, we now have a dedicated action ready to be used!

Nuget what?

For more informations on nugets, please refer to this section of the Gray Book.

Github what?

Github actions are small scripts with a specific purpose, allowing you to automate tasks on your repos. They are actually the building blocks of what's called a workflow : you chain several actions one after the other in your own small script, and decide under which condition the workflow is triggered (a new commit on master, a new tag, etc).

There are already tons of actions allowing you to do all sorts of things from creating issues to running unit tests, and even make phone calls with a predefined text!

The PublishVLNuget action

This action allows you to easily do the following tasks :

  • Build your Visual Studio solution, if your plugin has one
  • Download a package icon from an external url if you don't want to commit it to your repos every time
  • Pack your nuget either using a nuspec or a csproj file
  • Publish it to nuget.org (or any other feed)

In other words, you just have to push your code/patches and nuspec to github, and the script takes care of bringing it to nuget.org for you.

You can find the list of input parameters the action expects here.

How do I setup a workflow?

To get started with workflows, head over to the Github documentation.

Use cases

The action can adapt to many different scenarios. Let's cover three cases so you get an idea of how the action works, and how to adapt it to your needs.

My plugin does not have a visual studio solution

So your plugin solely consists of one (or many) VL documents and some help patches, plus your nuspec file that describes how your package will be structured.

(...) 
     - name: Publish VL Nuget
       uses: vvvv/PublishVLNuget@1.0.28
       with:
         nuspec: deployment/VL.MyPlugin.nuspec
         nuget-key: ${{ secrets.NUGET_KEY }}

Here, we are just using the nuspec and nuget-key inputs of the action.

My project has a Visual Studio solution and no nuspec file

Your csproj file can also describe how your nuget will be packed. In that case, simply omit the nuspec input. Note that if you provide a nuspec file anyway, it will take priority over your csproj.

I want to push to another nuget feed

By default, the action will push your package to nuget.org. You can simply use the nuget-feed input to push to a different feed.

Regarding external icons

I want to use an external icon, and my plugin has a nuspec file

The icon must be downloaded to an existing folder in your repo. We suggest you simply download it to its root :

(...)
- name: Publish VL Nuget
    uses: vvvv/PublishVLNuget@1.0.28
    with:
    (...)
    icon-src: https://wwww.url.to/nugeticon.png
    icon-dst: ./nugeticon.png
Paths in the workflow file are relative to the root of the repo!

Here, we ask the Github Action to download the icon from our URL and place it at the root of the repo.

Then, in the file section, your nuspec file must reference it from where the action will download it (src attribute) and place it wherever you like (target attribute), making sure target matches where the metadata section expects it.

(...)
    <metadata>
        (...)
        <icon>icon\nugeticon.png</icon>
    </metadata>
    <files>
        (...)
        <file src="..\nugeticon.png" target="icon\">
    </files>
(...)
Paths in the nuspec file are relative to where the file itself is placed!

I want to use an external icon and my plugin does not have a nuspec file

You can setup an icon for your project inside Visual Studio. The tricky part here is that you'll have to specify a path to a file that does not exist yet, since the Action will take care of downloading it later on. This can feel weird since Visual Studio's UI gives your a Browse button for you to pick a file. Simply fill the path manually to match the icon-src property of your workflow file.

For instance, your workflow file would look like this:

(...)
- name: Publish VL Nuget
    uses: vvvv/PublishVLNuget@1.0.28
    with:
    csproj: src\Whatever\Whatever.csproj
    icon-src: https://wwww.url.to/nugeticon.png
    icon-dst: ./deployment/nugeticon.png
    nuget-key: ${{ secrets.NUGET_KEY }}

and your VS package settings :

Thanks for reading, hope you'll enjoy using this one! If you are stuck or want more precision, don't hesitate to shout in the comments or in the forums.

Cheeeerz

sebescudie, Friday, Sep 25th 2020 Digg | Tweet | Delicious 0 comments  
  • 1

anonymous user login

Shoutbox

~1d ago

skyliner: wanna do drone shows or applications? then check this super cool project of our man e1n

~5d ago

NoseBleedIndustries: Thanks Joreg! The few minutes I was able to see, very good workshops!

~5d ago

joreg: @NoseBleedIndustries please give us some days, we'll have an announcement soon...

~5d ago

NoseBleedIndustries: I could not assist the Node20 (workshops ) Any Idea when we will have access to the links of the recordings?

~7d ago

bjoern: unity has c# bindings for usd, under apache license: https://github.com/Unity-Technologies/usd-unity-sdk

~15d ago

ravazquez: @synth yes they are being recorded and will be available for future consumption

~16d ago

synth: Another stupid question: Are all #NODE20 sessions recorded and accessible for later viewing in case someone missed something?

~17d ago

joreg: Get a fresh drink and some snacks: Live in 45 minutes: #NODE20 opening: https://youtu.be/SlKKyEUihhY