I'm trying to add my custom Azure artifact feed to a GitHub action build. I've added a line which adds the package as a source.
run: dotnet nuget add source ${{ env.nuget_feed_source }} --name ${{ env.nuget_feed_name }} --username az --password ${{ secrets.ARTIFACTKEY }} --store-password-in-clear-text
However, when I go to restore the package, I get an error saying it can't find the package
error NU1101: Unable to find package *****. No packages exist with this id in source(s): ****, nuget.org
To me, this looks like it's trying to search the default NuGet feed rather than my custom.
I tried adding a nuget.config
file but then I got the error:
error: The name specified has already been added to the list of available package sources. Provide a unique name.
If I create a nuget.config
with just the default feed, and manually add my package, it is successful but I still get a similar error:
error NU1301: Unable to load the service index for source ***
Any help would be greatly appreciated.
Thanks, Adam
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Add custom nuget source
run: dotnet nuget add source ${{ env.nuget_feed_source }} --name ${{ env.nuget_feed_name }} --username az --password ${{ secrets.ARTIFACTKEY }} --store-password-in-clear-text
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}"
- name: Deploy to Azure Function App
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
publish-profile: ${{ secrets.InsertPair_e2f5 }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
Turns out the personal access token I was using didn't have the correct permissions to access the feed :/
Enabling all access fixed my issue