(A) Database to artifact #928
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: (A) Database to artifact | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '16 11 * * *' | |
permissions: | |
contents: write | |
actions: read | |
pull-requests: write | |
jobs: | |
build: | |
name: Grab backup and fix backup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Store day of week | |
run: echo "week_day=$(date +%a)" >> $GITHUB_ENV | |
- uses: ./.github/actions/dingorunner | |
if: ${{ env.week_day == 'Sun' }} | |
env: | |
runner: cr | |
terminus_api: ${{ secrets.TERMINUS_API }} | |
SSH_PRIVATE_KEY: ${{ secrets.PANTHEON_DEPLOY_KEY}} | |
site_name: ${{ secrets.TERMINUS_SITE_NAME }} | |
env: live | |
- uses: ./.github/actions/dingorunner | |
env: | |
runner: bkup | |
terminus_api: ${{ secrets.TERMINUS_API }} | |
SSH_PRIVATE_KEY: ${{ secrets.PANTHEON_DEPLOY_KEY}} | |
site_name: ${{ secrets.TERMINUS_SITE_NAME }} | |
env: live | |
- id: Lando | |
uses: necyberteam/amp_lando_start@main | |
with: | |
DATABASE: '' | |
GH_TOKEN_REPO: ${{ secrets.GH_TOKEN_REPO }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sanitize backup | |
run: | | |
lando drush sql-sanitize --sanitize-password=y -y | |
lando drush cim | |
lando drush cr | |
lando drush updb | |
lando drush user-create authenticated_test_user --mail="[email protected]" --password="6%l7iF}6(4tI" | |
lando drush user-create administrator_test_user --mail="[email protected]" --password="b8QW]X9h7#5n" | |
lando drush user-add-role "administrator" administrator_test_user | |
lando drush en amp_dev | |
lando drush pmu amp_dev | |
lando drush pmu symfony_mailer | |
lando drush en symfony_mailer | |
lando drush cr | |
lando db-export site.sql | |
env: | |
gh_token: ${{ secrets.GH_TOKEN_REPO }} | |
- name: 'Upload Backup Artifact' | |
uses: actions/[email protected] | |
with: | |
name: amp-daily-backup | |
path: site.sql.gz | |
retention-days: 5 |