2024-12-14 #8
Workflow file for this run
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: Moodle Database Schema Generator | |
on: | |
release: | |
types: [created] | |
permissions: | |
contents: write | |
jobs: | |
moodle-schema: | |
strategy: | |
matrix: | |
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE'] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:10.6 | |
env: | |
MYSQL_ROOT_PASSWORD: a | |
ports: | |
- 3312:3306 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Clone Moodle Repository | |
run: git clone --branch ${{ matrix.moodle-branch }} https://github.com/moodle/moodle moodle_src | |
- name: Find XMLDB Files | |
run: find moodle_src -name install.xml > list_of_xmldb_files.txt | |
- name: Run Python Script to Convert XMLDB to SQL | |
run: python3 convert_xmldb_to_create_table_statements.py > create_tables.sql | |
- name: Test SQL File | |
run: | | |
echo "CREATE DATABASE IF NOT EXISTS diagram;" | mysql -h 127.0.0.1 -P 3312 -u root -pa | |
cat create_tables.sql | mysql -h 127.0.0.1 -P 3312 -u root -pa -D diagram | |
- name: Rename and compress SQL file with xz | |
run: mv create_tables.sql create_moodle_tables_${{ matrix.moodle-branch }}.sql && xz -e9 create_moodle_tables_${{ matrix.moodle-branch }}.sql | |
- name: Upload artifact to the release | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} create_moodle_tables_${{ matrix.moodle-branch }}.sql.xz --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |