-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Auto database update | ||
on: | ||
schedule: | ||
- cron: '24 21,23 * * Tue,Wed,Fri,Sat' | ||
workflow_dispatch: | ||
jobs: | ||
release: | ||
name: latest version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: install dependencies | ||
run: npm i | ||
- name: update | ||
run: npm run updatedb | ||
- name: test | ||
run: npm run test | ||
- name: commit | ||
run: scripts/release.sh | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{secrets.GTOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# get current version from package.json | ||
RES1=`find data -name '*.dat' -size -1000k 2>/dev/null` | ||
if [ -z "$RES1" ]; then | ||
if ! git diff --quiet HEAD -- *.dat; then | ||
VERT=`node -p "var j=require('./package.json');j.version=j.version.split('.').slice(0,-1).join('.')+'.'+require('dayjs')().format('YYYYMMDD');require('fs').writeFileSync('./package.json',JSON.stringify(j,null,2));j.version;"` | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git commit -a -m "v${VERT} auto update ip database" | ||
npm publish | ||
fi | ||
fi |