bonjour,
to publish VL plugins, I used to rely on Azure Pipelines to build vs solutions (if any), pack a nuget and push it to nuget.org. i find that process kinda boring though : you have to setup a project there, connect it to your repo and to your nuget feed, get lost in the ton of menus… then github actions came to rescue!
writing a small yml file to your repo, you can trigger that same process on github. i made a small test repo that has a visual studio solution, a VL document that uses this solution and a bunch of help patches, this seems to be working :)
here are the steps :
- add a new secret to your repo containing a Nuget API key named
NUGET_KEY - in your
nuspec, make sure to also copy the.pdbfile. otherwise, the push will succeed anyway but the job will be marked as failed - under the Actions tab, click “Setup a workflow yourself” on the right
- github now creates a
main.ymlfile under.github/workflowsand lets you edit it. paste this and adapt it to your project :
name: push_nuget
# on push on master
on:
push:
branches:
- master
paths-ignore:
- README.md
jobs:
build:
runs-on: windows-latest
steps:
- name: Git Checkout
uses: actions/checkout@master
- name: Setup MSBuild.exe
uses: warrenbuckley/Setup-MSBuild@v1
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.4.0
- name: Build
run: msbuild src\Whatever\Whatever.csproj /t:Build /v:m /m /restore /p:Configuration=Release
- name: Nuget Pack
run: nuget pack ./deployment/GithubPackageTest.nuspec -Symbols -SymbolPackageFormat snupkg
- name: Nuget Push
run: nuget push *.nupkg ${{ secrets.NUGET_KEY }} -src https://api.nuget.org/v3/index.json
with this workflow, a new build will be triggered each time there’s a commit on master, except on README.md.
if you just need to pack some VL files (no vs solution), you can remove the steps named Setup MSBuild.exe and Build.
and you’re done! your project should now be pushed to the Nuget Gallery :)
it case you wanna have a look at the repo on which I experimented that, here it is.
any feedback is welcome :)
cheerz!
ps: github also has a market-place on which you can re-use prebuilt actions like this one. i’ll try to setup one in the next days, but those have to be written in JS so that might take some time :)