mirror of
https://github.com/partofmyid/register.git
synced 2026-06-05 10:36:50 +07:00
database sync
This commit is contained in:
parent
b5052b73dc
commit
d3c6ec4de9
4 changed files with 73 additions and 4 deletions
55
.github/workflows/db.yml
vendored
Normal file
55
.github/workflows/db.yml
vendored
Normal 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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue