Created
February 27, 2020 20:05
-
-
Save 0x15f/dd01b129634f078e918b6239b555358c to your computer and use it in GitHub Desktop.
This file contains hidden or 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: "Deploy to Production" | |
on: | |
push: | |
branches: | |
- production | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy code | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: ${{ secrets.DEPLOY_COMMAND }} | |
- name: Copy recoverable files | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "cp -vnpr public_html/pub deployment/ && cp -vnpr public_html/var deployment/ && cp -r public_html/app/etc deployment/app/" | |
- name: Composer | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "cd deployment && composer install --ignore-platform-reqs" | |
- name: Upgrade | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "deployment/bin/magento setup:upgrade" | |
- name: Build DI | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "deployment/bin/magento setup:di:compile" | |
- name: Deploy static content | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "deployment/bin/magento setup:static-content:deploy" | |
- name: Activate deployment | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "rm -rf public_html_old && mv public_html public_html_old && mv deployment public_html" | |
- name: Clear cache | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: "curl -X 'PURGE' -H'X-Magento-Tags-Pattern: .*' varnish && public_html/bin/magento cache:clean" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment