Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Update update.yml #18

Merged
merged 1 commit into from
Oct 19, 2023
Merged
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
50 changes: 8 additions & 42 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,15 @@ on:
- cron: '0 0 * * 0' # Run every Sunday at midnight (UTC)

jobs:
update_dependencies:
update-deps:
name: Update Node dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Check for updates
id: check_updates
run: |
CHANGES=$(npm outdated --json)
if [ "$CHANGES" == "null" ]; then
echo "No updates found."
echo "::set-output name=update_minor::false"
else
echo "Updates found."
echo "::set-output name=update_minor::true"
fi

- name: Update package version
if: steps.check_updates.outputs.update_minor == 'true'
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
git commit -am "Bump minor version"
git push --set-upstream origin ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update dependencies
if: steps.check_updates.outputs.update_minor == 'true'
run: npm update

- name: Push changes
if: steps.check_updates.outputs.update_minor == 'true'
uses: ad-m/github-push-action@v0.6.0
node-version-file: .nvmrc
- uses: neverendingqs/gh-action-node-update-deps@v2
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
bump-version: patch # defaults to not bumping the package version