0

I have a gitlab pipeline where I get file from the repository, change the value, and update this file

After this, I need to push the changed file to the repo

Here is the code of gitlab-ci

   variables:
  NUGET_URL: **********
  

stages:
  - publish-nuget-package
   
step-publish-nuget-package:
  stage: publish-nuget-package
  image: mcr.microsoft.com/dotnet/core/sdk:3.1
  before_script:
    - dotnet tool install --global dotnet-ef
    - export PATH="$PATH:/root/.dotnet/tools"
    - dotnet tool install -g AWS.CodeArtifact.NuGet.CredentialProvider
    - dotnet codeartifact-creds install
  script:
    - x=$(awk '{print $2}' ./package-version.txt)
    - ((x++))
    - echo "${x}"
    - cd Monspire.EmailSender.Contracts
    - dotnet pack -c Release /p:Version="${x}"
    - echo "VERSION_NUMBER:\ ${x}" > package-version.txt
    - cd Monspire.EmailSender.Contracts/bin/Release/
    - dotnet nuget push Monspire.EmailSender.Contracts."${x}".0.0.nupkg --source $NUGET_URL
  environment: development
  tags:
    - monspire
  only:
    - main

at this string, I make changes echo "VERSION_NUMBER:\ ${x}" > package-version.txt

How now I can push the changed file to the repo?

Eugene Sukh
  • 1,997
  • 4
  • 25
  • 64
  • Does this answer your question? [How do I push to a repo from within a gitlab CI pipeline?](https://stackoverflow.com/questions/51716044/how-do-i-push-to-a-repo-from-within-a-gitlab-ci-pipeline) – Arty-chan Mar 12 '22 at 21:41

0 Answers0