add: regions database table (#657) #161
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
name: Export JSON/XML/YAML/CSV | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '**' | |
- '!scripts/export**' | |
workflow_dispatch: | |
inputs: | |
pass: | |
description: 'Passcode' | |
required: true | |
jobs: | |
export_json_xml: | |
name: JSON/XML/YAML/CSV | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
extensions: intl #optional | |
ini-values: "post_max_size=256M" #optional | |
- name: Cleanup world.sql | |
run: | | |
grep -v "DROP TABLE" sql/world.sql > tmpfile && mv tmpfile sql/world.sql | |
echo -e "DROP TABLE IF EXISTS \`countries\`;\n\n$(cat sql/world.sql)" > sql/world.sql | |
echo -e "DROP TABLE IF EXISTS \`states\`;\n$(cat sql/world.sql)" > sql/world.sql | |
echo -e "DROP TABLE IF EXISTS \`cities\`;\n$(cat sql/world.sql)" > sql/world.sql | |
- name: Create & Import DB | |
run: | | |
ls -R | |
sudo /etc/init.d/mysql start | |
mysql -uroot -proot -e "CREATE DATABASE world;" | |
mysql -uroot -proot -e "SHOW DATABASES;" | |
mysql -uroot -proot world < sql/world.sql | |
- name: Composer Dependencies | |
run: cd scripts/vendor && composer install | |
- name: Run Export Scripts | |
run: | | |
php scripts/export.php | |
php scripts/export_xml.php | |
php scripts/export_yaml.php | |
php scripts/export_csv.php | |
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world countries > sql/countries.sql | |
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world states > sql/states.sql | |
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world cities > sql/cities.sql | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: Add exported JSON, CSV, XML & YAML files | |
committer: Darshan Gada <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: true | |
branch: export/Files | |
delete-branch: true | |
title: '(chore): Export JSON, CSV, XML & YAML files' | |
labels: | | |
exports | |
automated | |
reviewers: dr5hn, valerianpereira |