CD #26
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: CD | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
production: | |
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
name: Production | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://niklan.net | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create SSH key | |
uses: ./.github/actions/create-ssh-key | |
with: | |
private-key: ${{ secrets.cd_production_deploy_key }} | |
user: ${{ secrets.cd_production_user }} | |
host: ${{ secrets.cd_production_host }} | |
port: ${{ secrets.cd_production_port }} | |
- name: Deploy | |
shell: bash | |
run: | | |
ssh server <<< " | |
cd ${{ secrets.cd_production_app_root }}; | |
mkdir -p ${{ secrets.cd_production_deploy_files }}; | |
drush sql:dump \ | |
--gzip \ | |
--structure-tables-list=cache,cache_*,flood,history,queue,search_index,search_api_*,semaphore,sequences,sessions,watchdog \ | |
> ${{ secrets.cd_production_deploy_files }}/pre-deploy.sql.gz; | |
git fetch; | |
git checkout; | |
git pull; | |
composer install --no-dev -o -n; | |
drush deploy; | |
drush queue:delete warmer; | |
drush warmer:enqueue entity; | |
" |