Commit 0df181a 1 parent 55de013 commit 0df181a Copy full SHA for 0df181a
File tree 2 files changed +87
-0
lines changed
2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Timezone update
2
+ on :
3
+ schedule :
4
+ # Run once a week at 00:05 AM UTC on Sunday.
5
+ - cron : 5 0 * * 0
6
+
7
+ workflow_dispatch :
8
+
9
+ jobs :
10
+ timezone_update :
11
+ if : github.repository == 'nodejs/node'
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - name : Checkout nodejs/node
16
+ uses : actions/checkout@v3
17
+ with :
18
+ persist-credentials : false
19
+
20
+ - name : Checkout unicode-org/icu-data
21
+ uses : actions/checkout@v3
22
+ with :
23
+ path : icu-data
24
+ persist-credentials : false
25
+ repository : unicode-org/icu-data
26
+
27
+ - run : ./tools/update-timezone.mjs
28
+
29
+ - name : Open Pull Request
30
+ uses : gr2m/create-or-update-pull-request-action@6720400cad8e74d7adc64640e4e6ea6748b83d8f # Create a PR or update the Action's existing PR
31
+ env :
32
+ GITHUB_TOKEN : ${{ secrets.GH_USER_TOKEN }}
33
+ with :
34
+ author : Node.js GitHub Bot <github-bot@iojs.org>
35
+ body : |
36
+ This PR was generated by tools/timezone-update.yml.
37
+
38
+ Updates the ICU files as per the instructions present in https://github.com/nodejs/node/blob/main/doc/contributing/maintaining-icu.md#time-zone-data
39
+
40
+ To test, build node off this branch & log the version of tz using
41
+ ```js
42
+ console.log(process.versions.tz)
43
+ ```
44
+ branch : actions/timezone-update
45
+ commit-message : ' deps: update timezone'
46
+ labels : dependencies
47
+ title : ' deps: update timezone'
48
+ reviewers : \@nodejs/i18n-api
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+ // Usage: tools/update-timezone.mjs
3
+ import { execSync , spawnSync } from 'node:child_process' ;
4
+ import { renameSync , readdirSync , rmSync } from 'node:fs' ;
5
+ import { exit } from 'node:process' ;
6
+
7
+ const fileNames = [
8
+ 'zoneinfo64.res' ,
9
+ 'windowsZones.res' ,
10
+ 'timezoneTypes.res' ,
11
+ 'metaZones.res' ,
12
+ ] ;
13
+
14
+ const availableVersions = readdirSync ( 'icu-data/tzdata/icunew' , { withFileTypes : true } )
15
+ . filter ( ( dirent ) => dirent . isDirectory ( ) )
16
+ . map ( ( dirent ) => dirent . name ) ;
17
+
18
+ const currentVersion = process . versions . tz ;
19
+ const latestVersion = availableVersions . sort ( ) . at ( - 1 ) ;
20
+
21
+ if ( latestVersion === currentVersion ) {
22
+ console . log ( `Terminating early, tz version is latest @ ${ currentVersion } ` ) ;
23
+ exit ( ) ;
24
+ }
25
+
26
+ execSync ( 'bzip2 -d deps/icu-small/source/data/in/icudt*.dat.bz2' ) ;
27
+ fileNames . forEach ( ( file ) => {
28
+ renameSync ( `icu-data/tzdata/icunew/${ latestVersion } /44/le/${ file } ` , `deps/icu-small/source/data/in/${ file } ` ) ;
29
+ spawnSync (
30
+ 'icupkg' , [
31
+ '-a' ,
32
+ file ,
33
+ 'icudt*.dat' ,
34
+ ] , { cwd : 'deps/icu-small/source/data/in/' }
35
+ ) ;
36
+ rmSync ( `deps/icu-small/source/data/in/${ file } ` ) ;
37
+ } ) ;
38
+ execSync ( 'bzip2 -z deps/icu-small/source/data/in/icudt*.dat' ) ;
39
+ rmSync ( 'icu-data' , { recursive : true } ) ;
You can’t perform that action at this time.
0 commit comments