(A) Database to artifact #368
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 * * *' | |
jobs: | |
build: | |
name: Grab backup and fix backup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install Lando | |
run: | | |
sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-v3.6.4" | |
sudo chmod +x /usr/local/bin/lando | |
- name: Setup Lando cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.lando/cache | |
key: ${{ runner.os }}-lando${{ matrix.lando.version }}-${{ github.ref }} | |
restore-keys: | | |
${{ runner.os }}-lando${{ matrix.lando.version }}- | |
- name: Start Lando | |
run: | | |
echo "$lando_env" > .env | |
mkdir -p web/sites/default/settings | |
cp blt/lando.local.settings.php web/sites/default/settings/local.settings.php | |
lando destroy -y | |
lando start && lando xdebug-off | |
env: | |
lando_env: ${{ secrets.LANDO_ENV }} | |
SSH_PRIVATE_KEY: ${{ secrets.PANTHEON_DEPLOY_KEY}} | |
- 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 | |
- name: Sync DB | |
run: | | |
lando composer config -g github-oauth.github.com $gh_token | |
composer config -g github-oauth.github.com $gh_token | |
composer install --ignore-platform-reqs | |
lando db-import backups/site.sql.gz | |
cd web | |
lando drush cr | |
lando drush deploy | |
lando drush sql-sanitize --sanitize-password -y | |
lando drush en amp_dev | |
lando drush pmu amp_dev | |
lando drush cr | |
cd .. | |
lando db-export site.sql | |
env: | |
gh_token: ${{ secrets.GH_TOKEN_REPO }} | |
- name: 'Upload Backup Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: amp-daily-backup | |
path: site.sql.gz | |
retention-days: 5 |