-
Notifications
You must be signed in to change notification settings - Fork 111
65 lines (51 loc) · 1.69 KB
/
upgrade-packages.yml
File metadata and controls
65 lines (51 loc) · 1.69 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# See tutorial:
# https://michaelcurrin.github.io/code-cookbook/recipes/ci-cd/github-actions/workflows/node/upgrade-packages.html
name: Upgrade NPM packages
on:
workflow_dispatch:
#schedule:
# - cron: '0 0 * * 0'
jobs:
upgrade-packages:
name: Upgrade packages
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Set up Node.js ⚙️
uses: actions/setup-node@v2
with:
node-version: '16.x'
cache: 'yarn'
- name: Check for outdated packages 🔍
id: vars
run: |
OUTDATED=$(yarn outdated) || true
if [[ -z "$OUTDATED" ]]; then
echo 'Nothing to upgrade'
else
echo 'Found outdated packages:'
echo "$OUTDATED"
fi
echo "::set-output name=outdated::$OUTDATED"
- name: Upgrade packages ⏫
if: ${{ steps.vars.outputs.outdated != '' }}
run: yarn upgrade
- name: Lint 🧐
if: ${{ steps.vars.outputs.outdated != '' }}
run: yarn lint:check
- name: Test 🚨
if: ${{ steps.vars.outputs.outdated != '' }}
run: yarn test:unit
- name: Build 🏗️
if: ${{ steps.vars.outputs.outdated != '' }}
run: yarn build
env:
NODE_ENV: production
- name: Commit and create PR 🔀
if: ${{ steps.vars.outputs.outdated != '' }}
uses: peter-evans/create-pull-request@v3
with:
title: 'build(deps): Upgrade NPM packages (automated)'
branch: 'build-deps-upgrade-npm-packages-automated'
commit-message: 'build(deps): upgrade NPM packages (automated)'