Update README.md #44
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: 'Publish: Taxonomy MySQL database' | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_USER: root | |
DB_PWD: ${{ secrets.MYSQL_PASSWORD }} | |
DB_DB: cfa_project_index | |
jobs: | |
publish-mysql: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.7.0 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v2 | |
- name: Set up connection to Kubernetes cluster | |
run: | | |
test -e ~/.kube || mkdir ~/.kube | |
echo "${{ secrets.MYSQL_KUBECONFIG_BASE64 }}" | base64 -d > ~/.kube/config | |
- name: Open port forwarding to MySQL | |
run: | | |
MYSQL_POD=$(kubectl get pod -l service=mysql -o jsonpath='{.items[0].metadata.name}') | |
kubectl port-forward "pods/$(kubectl get pod -l service=mysql -o jsonpath='{.items[0].metadata.name}')" 3306:3306 & | |
- name: Set up virtual env | |
run: | | |
cd tools/mysql-loader | |
python -m venv ".venv" | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Drop tables | |
run: mysql -h "${DB_HOST}" -u "${DB_USER}" -p"${DB_PWD}" < tools/mysql-loader/drop-schema.sql | |
- name: Create tables | |
run: mysql -h "${DB_HOST}" -u "${DB_USER}" -p"${DB_PWD}" < tools/mysql-loader/create-schema.sql | |
- name: Load tags and synonyms | |
run: | | |
cd tools/mysql-loader | |
source .venv/bin/activate | |
python taxonomy-toml-2-mysql.py | |
# - uses: mxschmitt/action-tmate@v3 | |
# if: failure() |