-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (38 loc) · 1.44 KB
/
auto-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 }}'