I’m trying to have yarn publish an NPM package in CodeBuild, and then push the updated package.json back to GitHub Enterprise. Everything is working except the push part. It’s not a credentials issue because the CodeBuild is able to fetch everything from the GitHub server (SSH has already been setup).
Once it has the pushed tag, it is:
- Setting
user.nameanduser.emailfor git config - Finding the branch that the tag was pushed to:
git branch —-contains tags/<tag> | sed -n 2p | awk ‘{printf $1}’ - Checking out that branch:
git checkout <branch> - Publishing via
yarn publish —-no-git-tag-version —-new-version <version from tag>which also changes and commits thepackage.jsonchange. - Finally it runs
git push origin <branch>
Step 1-4 seem to be working great, but step 5 just outputs “everything up-to-date” even though yarn publish changed and committed the package.json.
What else needs to be done to commit/push from CodeBuild? I’ve also tried putting git fetch —-unshallow before everything in case it needed more info, but that didn’t change anything. It’s as if checking out a branch in CodeBuild doesn’t track the remote branch?