summaryrefslogtreecommitdiff
path: root/.github/workflows/tools.yml
blob: 0865467060bde17cd6b4b7729292d09cce6272cd (plain)
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
173
174
175
176
177
178
179
180
name: Tools and deps update
on:
  schedule:
    # Run once a week at 00:05 AM UTC on Sunday.
    - cron: 5 0 * * 0

  workflow_dispatch:

permissions:
  contents: read

jobs:
  tools-deps-update:
    if: github.repository == 'nodejs/node'
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false  # Prevent other jobs from aborting if one fails
      matrix:
        include:
          - id: eslint
            subsystem: tools
            label: tools
            run: |
              ./tools/dep_updaters/update-eslint.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: corepack
            subsystem: deps
            label: dependencies
            run: |
              make corepack-update
              echo "NEW_VERSION=$(node deps/corepack/dist/corepack.js --version)" >> $GITHUB_ENV
          - id: lint-md-dependencies
            subsystem: tools
            label: tools
            run: |
              cd tools/lint-md
              npm ci
              NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs)
              if [ "$NEW_VERSION" != "" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                rm -rf package-lock.json node_modules
                # Include $NEW_VERSION to explicitly update the package.json
                # entry for the dependency and also so that semver-major updates
                # are not skipped.
                npm install --ignore-scripts $NEW_VERSION
                npm install --ignore-scripts
                cd ../..
                make lint-md-rollup
              fi
          - id: doc
            subsystem: tools
            label: tools
            run: |
              cd tools/doc
              npm ci
              NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs)
              if [ "$NEW_VERSION" != "" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                rm -rf package-lock.json node_modules
                # Include $NEW_VERSION to explicitly update the package.json
                # entry for the dependency and also so that semver-major updates
                # are not skipped.
                npm install --ignore-scripts $NEW_VERSION
                npm install --ignore-scripts
              fi
          - id: undici
            subsystem: deps
            label: dependencies
            run: |
              NEW_VERSION=$(npm view undici dist-tags.latest)
              CURRENT_VERSION=$(node -p "require('./deps/undici/src/package.json').version")
              if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                ./tools/update-undici.sh
              fi
          - id: postject
            subsystem: deps,test
            label: test
            run: |
              ./tools/dep_updaters/update-postject.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: base64
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-base64.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: acorn
            subsystem: deps
            label: dependencies
            run: |
              NEW_VERSION=$(npm view acorn dist-tags.latest)
              CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn/package.json').version")
              if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                ./tools/update-acorn.sh
              fi
          - id: acorn-walk
            subsystem: deps
            label: dependencies
            run: |
              NEW_VERSION=$(npm view acorn-walk dist-tags.latest)
              CURRENT_VERSION=$(node -p "require('./deps/acorn/acorn-walk/package.json').version")
              if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                ./tools/update-acorn-walk.sh
              fi
          - id: libuv
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-libuv.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: simdutf
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-simdutf.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: ada
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-ada.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: nghttp2
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-nghttp2.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: llhttp
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-llhttp.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: c-ares
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-c-ares.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
    steps:
      - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c  # v3.3.0
        with:
          persist-credentials: false
      - run: ${{ matrix.run }}
        env:
          GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
      - uses: gr2m/create-or-update-pull-request-action@77596e3166f328b24613f7082ab30bf2d93079d5
        # Creates a PR or update the Action's existing PR, or
        # no-op if the base branch is already up-to-date.
        env:
          GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
        with:
          author: Node.js GitHub Bot <github-bot@iojs.org>
          body: This is an automated update of ${{ matrix.id }} to ${{ env.NEW_VERSION }}.
          branch: actions/tools-update-${{ matrix.id }}  # Custom branch *just* for this Action.
          commit-message: '${{ matrix.subsystem }}: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}'
          labels: ${{ matrix.label }}
          title: '${{ matrix.subsystem }}: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}'