generate-aowow-database #13
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: generate-aowow-database | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
generate-aowow-db: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
# Need for python-selenium headless | |
- name: Setting up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Removing previous chrome instances on runner | |
run: sudo apt purge google-chrome-stable | |
- name: Installing all necessary packages | |
run: pip install chromedriver-autoinstaller selenium pyvirtualdisplay | |
- name: Install xvfb | |
run: sudo apt-get install xvfb | |
- name: "run scripts" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git clone https://github.com/azerothcore/acore-docker | |
cd acore-docker | |
docker compose up -d | |
cd ../setup/ | |
# bash generate-db.sh | |
cd .. | |
touch aowow_update.sql | |
touch acore_world.sql | |
mv setup/auto-update.py ./auto-update.py | |
sed -i "1i USE my_wowgmaing;\n" "aowow_update.sql" | |
sed -i "1i USE my_wowgmaing;\n" "acore_world.sql" | |
zip aowow_update.sql.zip aowow_update.sql | |
zip acore_world.sql.zip acore_world.sql | |
python auto-update.py ${{ secrets.FTP_PASSWORD }} | |
revision=`mysql -u root -ppassword -P 63306 -h 127.0.0.1 -s -N -e "SELECT substring_index(substring_index(revision, 'rev. ', -1), '+ 2', 1) FROM acore_auth.uptime ORDER BY starttime DESC LIMIT 1;"` | |
release_name=$(date '+%Y-%m-%d_%H-%M-%S') | |
gh release create $release_name --title "$release_name" --notes "Revision: [$revision](https://github.com/azerothcore/azerothcore-wotlk/commit/$revision)" | |
gh release upload $release_name "aowow_db.sql.zip" | |
curl --user wowgaming:${{ secrets.FTP_PASSWORD }} ftp://[email protected]/aowow/template/pages/home.tpl.php >> home.tpl.php | |
file_path="home.tpl.php" | |
target_text="AzerothCore rev: <a href=\"https:\/\/github.com\/azerothcore\/azerothcore-wotlk\/commit\/" | |
replacement_text=" AzerothCore rev: <a href=\"https:\/\/github.com\/azerothcore\/azerothcore-wotlk\/commit\/$revision\">$revision<\/a>" | |
sed -i "/$target_text/c\\$replacement_text" "$file_path" | |
curl --user wowgaming:${{ secrets.FTP_PASSWORD }} --upload-file home.tpl.php ftp://[email protected]/aowow/template/pages/home.tpl.php |