forked from jandre/node-userid
-
Notifications
You must be signed in to change notification settings - Fork 9
172 lines (125 loc) · 4.43 KB
/
update.yml
File metadata and controls
172 lines (125 loc) · 4.43 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Update Dependencies, Test, and Commit
# Continuously update dependencies of this package and test with all versions of node on various OSes
on:
schedule:
# Every Saturday at 5:00am
- cron: 0 5 * * 6
jobs:
update:
runs-on: ubuntu-latest
name: Update Dependencies
steps:
- name: Enable color for Npm output
run: echo color = always >> .npmrc
- name: Checkout latest code
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- name: Install Node
uses: actions/setup-node@v1
- name: 'Debug: Node version'
run: node --version
# Update all dependencies
- name: 'Update dependencies'
run: npx npm-check-updates -u
env:
FORCE_COLOR: 1
# Install dependencies and Build
- name: Install dependencies and Build (using `npm install`)
run: npm install
- name: 'Info: Show differences'
run: git diff --color=always
- name: Clean touched but identical files
run: 'git update-index --refresh || :'
- name: Test for changes (don't continue if there aren't any)
id: changes
run: '! git diff-index --quiet HEAD --'
# TODO: bail out "successfully" here instead of as "error"
- name: Switch to update branch
run: git checkout -b npm-check-updates
- name: Add expected file changes
run: git add package.json package-lock.json
- name: Set Author
run: |
git config user.email actions@github.com
git config user.name GitHub Actions
- name: 'Commit changes'
run: git commit -m 'Automatic dependency update'
- name: Test for dangling changes (error if any remain!)
run: git diff-index --quiet HEAD --
- name: Push to GitHub
run: git push origin npm-check-updates --force
test-matrix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# There are problems on various architectures on lower versions that are more work to fix. Please open an issue if you need more version support
node: [12, 13, 14, 15, 16]
runs-on: ${{ matrix.os }}
needs: update
name: Test with Node ${{ matrix.node }} on ${{ matrix.os }}
steps:
- name: Enable color for Npm output
run: echo color = always >> .npmrc
- name: Checkout latest code
uses: actions/checkout@v2
with:
ref: npm-check-updates
- name: Install Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: 'Debug: Node version'
run: node --version
# Install dependencies and Build
- name: Install dependencies and Build (using `npm ci`)
run: npm ci
- name: 'Info: Show differences'
run: git diff --color=always
# Test long usernames on Linux
- name: Add long username for test (only on Linux)
if: runner.os == 'Linux'
run: sudo useradd UsernameWithMoreThan15Chars
- name: Add long groupname for test (only on Linux)
if: runner.os == 'Linux'
run: sudo useradd GroupnameWithMoreThan15Chars
- name: Test Linux (with long names)
run: npm test -- --color
if: runner.os == 'Linux'
env:
LONG_USERNAME_TEST: UsernameWithMoreThan15Chars
LONG_GROUPNAME_TEST: GroupnameWithMoreThan15Chars
# Don't test long usernames on macOS
- name: Test macOS (without long names)
run: npm test -- --color
if: runner.os == 'macOS'
merge:
name: 'Merge updates into master'
needs: test-matrix
runs-on: ubuntu-latest
steps:
- name: Enable color for Npm output
run: echo color = always >> .npmrc
- name: Checkout latest code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: master
- name: Merge
run: git merge --ff-only origin/npm-check-updates
- name: Set Author
run: |
git config user.email actions@github.com
git config user.name GitHub Actions
- name: Bump Version
run: npm version patch
- name: Push
run: git push --tags --atomic origin master
- name: Cleanup
run: git push origin --delete npm-check-updates
- name: Publish
run: npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}