Last active
February 12, 2025 23:09
-
-
Save salomvary/836afdbc137364c73631aa6845d091c1 to your computer and use it in GitHub Desktop.
GitHub Action for mysqldump
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: backup-mysql | |
on: | |
schedule: | |
# Run at 7:00 UTC every day | |
- cron: "0 7 * * *" | |
jobs: | |
run_mysqldump: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump database | |
env: | |
MYSQL_PWD: ${{ secrets.MYSQL_PWD }} | |
run: | | |
mysqldump \ | |
-u my-user \ | |
-h some.host.example.com \ | |
-P 4242 \ | |
--verbose \ | |
very_important_database \ | |
| bzip2 -c > latest.sql.bz2 | |
- name: Archive database dump | |
uses: actions/upload-artifact@v2 | |
with: | |
name: latest.sql.bz2 | |
path: latest.sql.bz2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment