Last active
November 27, 2020 17:30
-
-
Save imgerson/aa91c9eb84ae99169bc2b249224dd834 to your computer and use it in GitHub Desktop.
WC_MEXICO_2020: CD_WordPres
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 | |
# Trigers when production branch is updated. | |
on: | |
push: | |
branches: [ staging ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
deployment: | |
runs-on: Ubuntu-20.04 | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v2 | |
- name: Cancel past actions | |
uses: styfle/cancel-workflow-action@0.6.0 | |
with: | |
access_token: ${{ github.token }} | |
- name: Setup SSH | |
run: | | |
eval `ssh-agent -s` | |
mkdir ~/.ssh/ | |
echo "${{ secrets.HOST_KEY_SCAN }}" > ~/.ssh/known_hosts | |
echo "${{ secrets.SSH_KEY_STAGING }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-add ~/.ssh/id_rsa | |
- name: Logs WP CLI version | |
run: ssh ${{ secrets.STAGING_USER }}@${{ secrets.STAGING_IP }} "cd html; wp cli version" | |
- name: Install Node | |
uses: actions/setup-node@v2.1.2 | |
with: | |
node-version: 12 | |
- name: Install dependencies | |
run: npm install | |
- name: Setup WordPress env | |
run: | | |
npx wp-env start | |
npx wp-env run cli wp theme activate mostlydevstuff | |
- name: Run Cypress tests | |
run: | | |
cp cypress.json.example cypress.json | |
npx cypress run --config video=false | |
- name: Copy files to staging server | |
run: | | |
rsync -r --exclude node_modules $GITHUB_WORKSPACE/* \ | |
${{ secrets.STAGING_USER }}@${{ secrets.STAGING_IP }}:html/wp-content/themes/mostlydevstuff/ | |
- name: Clear cache :) | |
run: ssh ${{ secrets.STAGING_USER }}@${{ secrets.STAGING_IP }} "cd html; wp godaddy cache flush" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment