Auto-update npm libraries #739
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto-update npm libraries | |
# Be carefuly for which modules you activate auto-updates. | |
# Braking changes *MUST* be caught in the CI or they will cause errors. | |
# Updating test libraries like eslint should be safe however. | |
# Perform updates at 3am every day | |
on: | |
schedule: | |
- cron: "0 3 * * *" | |
jobs: | |
update-npm-libs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: prepare git | |
run: | | |
git config --global user.email '[email protected]' | |
git config --global user.name 'Update Bot' | |
- name: use node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
- name: update engage-ui test libraries | |
working-directory: modules/engage-ui | |
run: | | |
npm update --save --dev eslint eslint-plugin-header | |
npm audit fix || true | |
git add package.json package-lock.json | |
- name: update all engage-theodul-* libraries (they only have tests) | |
working-directory: modules/ | |
run: | | |
set -ue | |
for module in $(ls -1 engage-theodul-*/package.json | sed 's_/package.json__') | |
do | |
cd "${module}" | |
rm package-lock.json | |
npm update --dev | |
npm audit fix | |
git add package.json package-lock.json | |
cd - | |
done | |
- name: make sure tests still work | |
working-directory: modules/engage-theodul-core | |
run: | | |
set -ue | |
for module in $(ls -1 engage-theodul-*/package.json | sed 's_/package.json__') | |
do | |
cd "${module}" | |
npm run eslint | |
cd - | |
done | |
#NB: The || true after the commit ensures that the pipeline doesn't fail | |
# (and send emails) if there are no updates available | |
- name: push changes | |
run: | | |
git commit -m 'Auto-update npm packages' || true | |
git push |