I am new to GitHub actions.
I have created a ci.main
workflow. Below is my code.
After running I can’t view the package in the repository section.
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: >
dotnet pack package
-p:Version=1.0.0
-c Release
-o ./location
--include-source
- name: Push
run: >
dotnet nuget push
./location/*.nupkg
--source "https://nuget.pkg.github.com/orginization/index.json"
--api-key xxxxxxx --skip-duplicate
2
Answers
As your package is pushed successfully but it’s not visible under your repository packages, you need to verify the organization packages as well. You may follow the Viewing packages docs to do that.
Also, according to Connecting a repository to a package:
So, you have to manually link the package to your repository if it’s already published by following the steps mentioned in the docs above.
And, according to Publishing a package:
So, to make it automatically connect to your repository, you’ll have to update your
nuget.config
file accordingly.There are a handful of ways to accomplish this:
1. Automagically
If you publish with the generated token GitHub will automatically attach the repo to the package. Just ensure you have added write permissions on the job:
2. Manually
This is the easiest method, but will have to be done for every package you publish.
Go to the package page and connect the desired repository repositories: https://github.com/orgs/{org}/packages/nuget/{package}
Note that this appears to be a one-time operation, you cannot undo this without deleting your package and re-pushing.
Docs
3. Via Configuration
From docs, by virtue of having 3a, 3b is generated with dotnet pack, but you can manually add to the nuspec if need be.
3a.
.csproj
Add the
RepositoryUrl
3b.
.nuspec
Add the
repository