Skip to content

Automatic Updates

Automatic Updates #25

Workflow file for this run

name: Automatic Updates
on:
schedule:
- cron: "15 0 * * 5"
workflow_dispatch:
jobs:
# We can't use "npx" to check ourselves (as it won't install _this_ package's
# old version) so we just define the whole automatic update process here
auto-update:
runs-on: ubuntu-latest
name: Automatic Updates
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.git_token }}
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Check and apply dependencies updates
run: |
# Install ourselves and build our "check-updates" script
npm clean-install
npm run build
# Check for updates, and exit script on error / no updates found
node ./dist/main.mjs --quick --bump || exit $(( $? == 255 ? 0 : $? ))
# If still here, just run a full package update and install dependencies
rm -rf node-modules package-lock.json
npm install
# Re-build our package
npm run build
# Commit all changes and push them back to the repo
git config user.email '[email protected]'
git config user.name 'Automatic Updates'
git commit -a -m "Release for automatic updates $(date '+%Y-%m-%d %H:%M:%S')"
git push -u origin '${{ github.ref_name }}'