database sync

This commit is contained in:
SX-9 2025-02-12 09:53:58 +07:00
commit d3c6ec4de9
4 changed files with 73 additions and 4 deletions

View file

@ -1,12 +1,15 @@
<!-- To make our job easier, please spend time to review your application before submitting. -->
<!--
To make our job easier, please spend time to review your application before submitting.
To check an item, add an 'X' between the brackets: '[ ]' => '[X]'
-->
## Requirements
- [ ] The website is reachable.
- [ ] You have completed your website.
<!-- ^^^^^^^ ignore if its not a website but provide a clear description of what your doing with this subdomain -->
- [ ] The CNAME record doesn't contain `https://` or `/`. <!-- ignore if your not using CNAME -->
- [ ] There is sufficient information at the `owner` field. (including `username`)
- [ ] The CNAME record is a valid hostname and doesn't contain `https://` or `/`. <!-- ignore if your not using CNAME -->
- [ ] There is sufficient information at the `owner` field. (including your github `username`)
- [ ] I have read the [README](https://github.com/partofmyid/register) for announcements in case of any updates.
- [ ] I know what im doing and everything is ready.

55
.github/workflows/db.yml vendored Normal file
View file

@ -0,0 +1,55 @@
name: Database Sync
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "domains/**"
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Generate database
run: node dbgen.js > database.json
- name: Upload database artifact
uses: actions/upload-artifact@v2
with:
name: database
path: database.json
upload:
needs: generate
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download database artifact
uses: actions/download-artifact@v2
with:
name: database
path: database.json
- name: Commit and push database.json
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add database.json
git commit -m 'Update database.json'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}