Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(circleci): Properly handle lockfile changes #117

Merged
merged 1 commit into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,30 @@ jobs:
name: Installing npm dependencies
command: npm install
- run:
name: Resetting package-lock changes
command: git checkout -- package-lock.json
name: Setting up deployment environment
command: |
echo "Setting up git user"
git config --global user.email circleci@circleci && git config --global user.name CircleCI

echo "Logging in to npm"
echo "$NPM_TOKEN" > ~/.npmrc
- run:
name: Preparing lockfile update
command: $(npm bin)/greenkeeper-lockfile-update
name: Handling package-lock changes
command: |
if git diff --exit-code package-lock.json; then
echo "package-lock did not change"
else
if [[ $CIRCLE_BRANCH = *"greenkeeper/"* ]]; then
echo "Committing package-lock changes"
git add package-lock.json
git commit -m 'chore(package): Update lockfile [ci skip]';
else
echo "Resetting package-lock changes"
git checkout -- package-lock.json
fi
fi

echo "Done"
- save_cache:
key: v1-npm-deps-{{ checksum "package-lock.json" }}
paths:
Expand Down Expand Up @@ -47,7 +66,7 @@ jobs:
MOCHA_FILE: ../reports/mocha.xml
when: always
- run:
name: Checking documentation for broken links (SKIPPED)
name: Checking documentation for broken links
command: npm run test:docs
when: always

Expand Down Expand Up @@ -76,16 +95,10 @@ jobs:
- add_ssh_keys
- deploy:
name: Updating lockfile
command: $(npm bin)/greenkeeper-lockfile-upload
command: git push origin $CIRCLE_BRANCH
- deploy:
name: Deploy changes
command: |
echo "Setting up git user"
git config --global user.email circleci@circleci && git config --global user.name CircleCI

echo "Logging in to npm"
echo "$NPM_TOKEN" > ~/.npmrc

npx bump-version release --release-files out docs/api --gh-token $RELEASE_GITHUB_TOKEN

if [ $CIRCLE_BRANCH = 'master' ]; then
Expand Down
Loading