Can I use the Github Secret?

I want to publish a Nuget package using the Automatic token authentication - GitHub Docs

name: Build Image
on: [push]
jobs:
  Publish Package:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3
      - name: Setup dotnet
        uses: https://github.com/actions/setup-dotnet@v3
        with:
          dotnet-version: '7.0.x'
      - name: Build
        run: dotnet build -c Release
      - name: Package
        run: dotnet pack -c Release -o output
      - name: Publish
        run: dotnet nuget push --source myrepo ./output/*.nupkg
        env:
          NUGET_USERNAME: gitea-actions
          NUGET_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

But it seems like it is not working

gitea-actions is a system username, you should not use it.

So which username should I use? I mean creating another account for uploading packages sounds redundant

If the ${{ secrets.GITHUB_TOKEN }} works as intended you can use the --api-key argument for dotnet nuget push instead of the username/password variables.

However, it does not seem to work correctly in gitea atm.

EDIT; Creating an access token with the package-scope and using it as a secret works great though!

1 Like

PR Add actions support to package auth verification by yp05327 · Pull Request #23729 · go-gitea/gitea · GitHub will fix the problem.

1 Like