Skip to content

Commit

Permalink
chore(ci): Move logic in update-npm.sh into GA workflow
Browse files Browse the repository at this point in the history
PR-URL: #3324
Credit: @gimli01
Close: #3324
Reviewed-by: @wraithgar
  • Loading branch information
Daniel Park authored and wraithgar committed May 28, 2021
1 parent 97a898d commit 685f4be
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/create-cli-deps-pr.yml
Expand Up @@ -14,6 +14,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.NPM_ROBOT_USER_PAT }}
NPM_VERSION: ${{ github.event.inputs.npmVersion }}
SUPPORT_BRANCH: "v14.x-staging"
steps:
- name: Checkout npm/node
uses: actions/checkout@v2
Expand All @@ -25,18 +26,47 @@ jobs:
- name: Run dependency updates and create PR
run: |
npm_tag=""
base_branch=""
if [ "$NPM_VERSION" == "latest" ]
then
npm_tag=`npm view npm@latest version`
base_branch="master"
else
npm_tag="$NPM_VERSION"
base_branch="v14.x-staging"
fi
git config user.name "npm-robot"
git config user.email "ops+robot@npmjs.com"
git checkout -b "npm-$npm_tag"
./tools/update-npm.sh "$npm_tag"
BASE_DIR="$( pwd )"/
DEPS_DIR="$BASE_DIR"deps/
echo "Cloning CLI repo"
gh repo clone npm/cli
echo "Prepping CLI repo for release"
cd cli
git checkout v"$npm_tag"
make
make release
echo "Removing old npm"
cd "$DEPS_DIR"
rm -rf npm/
echo "Copying new npm"
tar zxf "$BASE_DIR"cli/release/npm-"$npm_tag".tgz
echo "Removing CLI workspace"
cd "$BASE_DIR"
rm -rf cli
git add -A deps/npm
git commit -m "deps: upgrade npm to $npm_tag"
git rebase --whitespace=fix HEAD^
git push origin "npm-$npm_tag"
gh_release_body=`gh release view v"$npm_tag" -R npm/cli`
echo $gh_release_body
gh pr create -R "npm/node" -B "$base_branch" -H "npm:$release_branch_name" --title "deps(cli): upgrade npm to $npm_version" --body "$gh_release_body"
gh pr create -R "nodejs/node" -B "$base_branch" -H "npm:npm-$npm_tag" --title "deps(cli): upgrade npm to $npm_tag" --body "$gh_release_body"

0 comments on commit 685f4be

Please sign in to comment.