Backup our DNS to zone files #1392
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 our DNS to zone files | |
# Run this workflow at 4:30 every day | |
on: | |
#push | |
schedule: | |
- cron: '30 4 * * *' | |
jobs: | |
backup: | |
strategy: | |
matrix: | |
domains: [codeenigma.net, codeenigma.com, codeenigma.fr, codeenigma.uk, codeenigma.co.uk] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
#git config --global --add safe.directory '*' | |
wget https://github.com/barnybug/cli53/releases/download/0.8.18/cli53-linux-amd64 | |
sudo mv cli53-linux-amd64 /usr/local/bin/cli53 | |
sudo chmod +x /usr/local/bin/cli53 | |
mkdir ~/.aws | |
touch ~/.aws/credentials | |
cat >> ~/.aws/credentials <<EOL | |
[default] | |
aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
EOL | |
- name: Export zone file | |
run: | | |
cli53 export --full ${{ matrix.domains }} > ${{ matrix.domains }}.txt | |
git add . | |
# Random 1-30 second sleep so commits don't trip over each other | |
sleep $[ ( $RANDOM % 30 ) + 1 ]s | |
- name: Push changes | |
uses: github-actions-x/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push-branch: main | |
commit-message: 'Latest backup of ${{ matrix.domains }}.' | |
rebase: 'true' | |
name: 'Code Enigma CI' | |
email: '[email protected]' |