Generate schema #17
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 schema | |
on: | |
schedule: | |
- cron: "0 6,18 * * *" | |
workflow_dispatch: | |
jobs: | |
generate-schema: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
- name: Checkout remote repository | |
uses: actions/checkout@v4 | |
with: | |
repository: "ethpandaops/xatu" | |
path: "xatu" | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Run Docker Compose in remote repo | |
run: | | |
cd xatu | |
docker compose --profile clickhouse up -d | |
- name: Wait for service on port 8123 to be up | |
run: | | |
timeout=60 # wait for up to 60 seconds | |
while ! curl --output /dev/null --silent --head --fail http://localhost:8123; do | |
printf '.' | |
timeout=$((timeout-1)) | |
if [ "$timeout" -le 0 ]; then | |
echo "Service did not become available on port 8123 in time" | |
exit 1 | |
fi | |
sleep 1 | |
done | |
echo "Service is up on port 8123" | |
- name: Wait for docker container xatu-clickhouse-migrator-1 to exit 0 | |
run: | | |
set -e # This will cause the script to exit on the first error | |
EXIT_CODE=$(docker wait xatu-clickhouse-migrator-1) | |
echo "Exit code: $EXIT_CODE" | |
if [ "$EXIT_CODE" != "0" ]; then | |
echo "Container exited with code $EXIT_CODE, failing the job." | |
exit 1 | |
fi | |
- name: Run generate-schema.sh for README.md | |
run: ./generate-schema.sh | |
- name: Run generate-schema.sh for README.hugo.md | |
env: | |
HUGO: true | |
README: README.hugo.md | |
run: ./generate-schema.sh | |
- name: Cleanup before commit | |
run: | | |
cd xatu | |
docker compose down | |
cd .. | |
rm -rf xatu | |
- name: Git diff | |
run: | | |
git diff --exit-code || echo "No changes to commit" | |
- name: Commit changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add -A | |
git commit -m "Update schema" || echo "No changes to commit" | |
git push |