geolite2-city 1.0.17 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,124 @@
1
+ name: Update GeoLite2-City Database
2
+
3
+ on:
4
+ schedule:
5
+ # Run every Tuesday and Friday at 06:00 UTC (MaxMind update days)
6
+ - cron: '0 6 * * 2,5'
7
+ workflow_dispatch:
8
+ inputs:
9
+ force_publish:
10
+ description: 'Force publish to npm even if no changes'
11
+ required: false
12
+ default: 'false'
13
+ type: boolean
14
+
15
+ jobs:
16
+ update:
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ contents: write
20
+ id-token: write # Required for npm trusted publishing (OIDC)
21
+
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+ with:
26
+ token: ${{ secrets.GITHUB_TOKEN }}
27
+
28
+ - name: Setup Node.js
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: '24' # Node 24 includes npm 11.5.1+ required for OIDC
32
+ registry-url: 'https://registry.npmjs.org'
33
+
34
+ - name: Download latest GeoLite2-City database
35
+ env:
36
+ MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
37
+ run: |
38
+ echo "Downloading GeoLite2-City database..."
39
+
40
+ # Download the database
41
+ curl -fsSL -o GeoLite2-City.tar.gz \
42
+ "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz"
43
+
44
+ # Check if download was successful
45
+ if [ ! -f GeoLite2-City.tar.gz ] || [ ! -s GeoLite2-City.tar.gz ]; then
46
+ echo "Download failed or file is empty"
47
+ exit 1
48
+ fi
49
+
50
+ # Extract the mmdb file
51
+ tar -xzf GeoLite2-City.tar.gz
52
+
53
+ # Find and move the mmdb file
54
+ MMDB_FILE=$(find . -name "GeoLite2-City.mmdb" -type f)
55
+ if [ -z "$MMDB_FILE" ]; then
56
+ echo "Could not find GeoLite2-City.mmdb in archive"
57
+ exit 1
58
+ fi
59
+
60
+ mv "$MMDB_FILE" ./GeoLite2-City.mmdb
61
+
62
+ # Compress with maximum compression
63
+ gzip -9 -f GeoLite2-City.mmdb
64
+
65
+ # Cleanup
66
+ rm -rf GeoLite2-City.tar.gz GeoLite2-City_*/
67
+
68
+ echo "Database downloaded and compressed successfully"
69
+ ls -lh GeoLite2-City.mmdb.gz
70
+
71
+ - name: Check for changes
72
+ id: check_changes
73
+ run: |
74
+ FORCE="${{ inputs.force_publish }}"
75
+ if [ "$FORCE" == "true" ]; then
76
+ echo "Force publish requested"
77
+ echo "changed=true" >> $GITHUB_OUTPUT
78
+ elif git diff --quiet GeoLite2-City.mmdb.gz 2>/dev/null; then
79
+ echo "No changes detected"
80
+ echo "changed=false" >> $GITHUB_OUTPUT
81
+ else
82
+ echo "Changes detected"
83
+ echo "changed=true" >> $GITHUB_OUTPUT
84
+ fi
85
+
86
+ - name: Update version and commit
87
+ if: steps.check_changes.outputs.changed == 'true'
88
+ run: |
89
+ # Bump patch version
90
+ npm version patch --no-git-tag-version
91
+
92
+ # Get new version
93
+ NEW_VERSION=$(node -p "require('./package.json').version")
94
+ echo "New version: $NEW_VERSION"
95
+
96
+ # Update README with current date
97
+ CURRENT_DATE=$(date +%Y-%m-%d)
98
+ sed -i "s/Last updated: .*/Last updated: ${CURRENT_DATE}/" README.md
99
+
100
+ # Configure git
101
+ git config --global user.name 'github-actions[bot]'
102
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
103
+
104
+ # Commit and push
105
+ git add .
106
+ git commit -m "Update GeoLite2-City database to v${NEW_VERSION} - ${CURRENT_DATE}"
107
+ git push
108
+
109
+ - name: Publish to npm
110
+ if: steps.check_changes.outputs.changed == 'true'
111
+ run: npm publish --provenance --access public
112
+
113
+ - name: Summary
114
+ run: |
115
+ if [ "${{ steps.check_changes.outputs.changed }}" == "true" ]; then
116
+ echo "### Database Updated Successfully" >> $GITHUB_STEP_SUMMARY
117
+ echo "" >> $GITHUB_STEP_SUMMARY
118
+ echo "- New version published to npm" >> $GITHUB_STEP_SUMMARY
119
+ echo "- CDN will be updated automatically via jsDelivr" >> $GITHUB_STEP_SUMMARY
120
+ else
121
+ echo "### No Updates Required" >> $GITHUB_STEP_SUMMARY
122
+ echo "" >> $GITHUB_STEP_SUMMARY
123
+ echo "The database is already up to date." >> $GITHUB_STEP_SUMMARY
124
+ fi
Binary file
package/README.md CHANGED
@@ -1,19 +1,123 @@
1
- # GeoLite2-City Database via jsDelivr CDN
1
+ # GeoLite2-City - Free IP Geolocation Database
2
2
 
3
- The GeoLite2-City database, provided by [MaxMind](https://www.maxmind.com/), is used for accurate geo-location information. It is an essential component of [WP Statistics](https://wordpress.org/plugins/wp-statistics/), a popular privacy-focused analytics solution for WordPress, enabling detailed insights into visitor locations.
3
+ [![npm version](https://img.shields.io/npm/v/geolite2-city.svg)](https://www.npmjs.com/package/geolite2-city)
4
+ [![npm downloads](https://img.shields.io/npm/dm/geolite2-city.svg)](https://www.npmjs.com/package/geolite2-city)
5
+ [![License](https://img.shields.io/badge/license-CC%20BY--SA%204.0-green)](https://creativecommons.org/licenses/by-sa/4.0/)
6
+ [![GitHub Stars](https://img.shields.io/github/stars/wp-statistics/GeoLite2-City?style=social)](https://github.com/wp-statistics/GeoLite2-City)
4
7
 
5
- ### Database Maintenance & Update Schedule
6
- Since this database is integrated with the WP Statistics plugin, **we currently update the database twice per month** to maintain the accuracy and reliability of the geo-location data.
8
+ Free MaxMind GeoLite2-City database for IP geolocation. Get city-level location data from any IP address. Automatically updated and served via jsDelivr CDN.
7
9
 
8
- After realizing its potential utility for other developers and projects, we decided to make the database easily accessible via GitHub and the jsDelivr CDN.
10
+ **Website:** [geo.wp-statistics.com](https://geo.wp-statistics.com)
9
11
 
10
- #### Last updated: 2025-07-30
12
+ #### Last updated: 2025-12-21
11
13
 
12
- ### Direct Download URL
13
- You can download the latest version of the GeoLite2-City database using the following link: [GeoLite2-City.mmdb.gz](https://cdn.jsdelivr.net/npm/geolite2-city/GeoLite2-City.mmdb.gz)
14
+ ---
14
15
 
15
- ### Source Location
16
- For the complete directory and additional resources, visit: [GeoLite2-City Source](https://cdn.jsdelivr.net/npm/geolite2-city/)
16
+ ## Features
17
17
 
18
- ### License Information
19
- The GeoLite2-City database is distributed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). Please review the license to understand your rights and responsibilities when using this resource.
18
+ - **City-Level Accuracy** - Get country, city, coordinates, timezone, and more
19
+ - **Auto-Updated** - Database updated automatically every Tuesday & Friday
20
+ - **Fast CDN** - Served via jsDelivr with global edge locations
21
+ - **No Authentication** - Direct download, no API keys required
22
+ - **Free Forever** - Open source under CC BY-SA 4.0 license
23
+
24
+ ---
25
+
26
+ ## Quick Start
27
+
28
+ ### Direct Download
29
+
30
+ ```
31
+ https://cdn.jsdelivr.net/npm/geolite2-city/GeoLite2-City.mmdb.gz
32
+ ```
33
+
34
+ ### PHP
35
+
36
+ ```php
37
+ use GeoIp2\Database\Reader;
38
+
39
+ $reader = new Reader('/path/to/GeoLite2-City.mmdb');
40
+ $record = $reader->city('128.101.101.101');
41
+
42
+ echo $record->country->name; // 'United States'
43
+ echo $record->city->name; // 'Minneapolis'
44
+ ```
45
+
46
+ ### Node.js
47
+
48
+ ```javascript
49
+ const { Reader } = require('@maxmind/geoip2-node');
50
+
51
+ const reader = await Reader.open('./GeoLite2-City.mmdb');
52
+ const response = reader.city('128.101.101.101');
53
+
54
+ console.log(response.country.names.en); // 'United States'
55
+ console.log(response.city.names.en); // 'Minneapolis'
56
+ ```
57
+
58
+ ### Python
59
+
60
+ ```python
61
+ import geoip2.database
62
+
63
+ reader = geoip2.database.Reader('./GeoLite2-City.mmdb')
64
+ response = reader.city('128.101.101.101')
65
+
66
+ print(response.country.name) # 'United States'
67
+ print(response.city.name) # 'Minneapolis'
68
+ ```
69
+
70
+ ### WordPress (WP Statistics)
71
+
72
+ ```php
73
+ use WP_Statistics\Service\Geolocation\GeolocationFactory;
74
+
75
+ $location = GeolocationFactory::getLocation('128.101.101.101');
76
+ echo $location['city']; // 'Minneapolis'
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Database Info
82
+
83
+ | Property | Value |
84
+ |----------|-------|
85
+ | **CDN URL** | `https://cdn.jsdelivr.net/npm/geolite2-city/GeoLite2-City.mmdb.gz` |
86
+ | **npm** | `npm install geolite2-city` |
87
+ | **Update Schedule** | Every Tuesday & Friday (automatic) |
88
+ | **Size** | ~68 MB (compressed) |
89
+ | **Format** | MaxMind DB (MMDB) |
90
+ | **License** | [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
91
+
92
+ ---
93
+
94
+ ## Update Schedule
95
+
96
+ This database is **automatically updated** via GitHub Actions:
97
+
98
+ - **Schedule:** Every Tuesday and Friday at 06:00 UTC
99
+ - **Source:** [MaxMind GeoLite2](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data)
100
+ - **Distribution:** Published to npm, served via jsDelivr CDN
101
+
102
+ ---
103
+
104
+ ## Related Resources
105
+
106
+ - **Documentation:** [geo.wp-statistics.com](https://geo.wp-statistics.com)
107
+ - **DB-IP Alternative:** [DbIP-City-lite](https://github.com/wp-statistics/DbIP-City-lite)
108
+ - **Country Database:** [GeoLite2-Country](https://github.com/wp-statistics/GeoLite2-Country)
109
+ - **WP Statistics:** [wordpress.org/plugins/wp-statistics](https://wordpress.org/plugins/wp-statistics/)
110
+
111
+ ---
112
+
113
+ ## Attribution
114
+
115
+ This database is provided by [MaxMind](https://www.maxmind.com/). When using this database, please include appropriate attribution as required by the [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0/).
116
+
117
+ ---
118
+
119
+ ## License
120
+
121
+ GeoLite2-City by MaxMind is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
122
+
123
+ Maintained by [VeronaLabs](https://veronalabs.com) and the [WP Statistics](https://wp-statistics.com) team.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geolite2-city",
3
- "version": "1.0.17",
3
+ "version": "1.0.23",
4
4
  "description": "GeoLite2-City.mmdb.gz CDN files based on Free Open Source CDN [jsDelivr!](https://www.jsdelivr.com/)",
5
5
  "scripts": {
6
6
  "test": ""
@@ -1,22 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- push:
8
- branches:
9
- - master
10
- jobs:
11
- publish:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v3
15
- - uses: actions/setup-node@v3
16
- with:
17
- node-version: 12
18
- - run: npm install
19
- - run: npm test
20
- - uses: JS-DevTools/npm-publish@v1
21
- with:
22
- token: ${{ secrets.NPM_TOKEN }}