Merge pull request #4193 from Codeinwp/new/next #1334
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: Deploy to stagings | |
on: | |
push: | |
branches: | |
- development | |
- "!master" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
name: Deploy to QA server | |
runs-on: ubuntu-latest | |
if: github.repository == 'Codeinwp/neve' | |
env: | |
SSH_USERNAME: ${{ secrets.SSH_USERNAME }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_PORT: ${{ secrets.SSH_PORT }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
QA_DS_STAGING_ROOT: ${{ secrets.QA_DS_STAGING_ROOT }} | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | |
CYPRESS_INSTALL_BINARY: 0 | |
steps: | |
- uses: actions/checkout@master | |
- name: Setup node 14 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Build dist | |
run: | | |
composer install --no-dev --prefer-dist --no-progress --no-suggest | |
yarn install --frozen-lockfile | |
yarn run build | |
yarn run dist | |
- name: Sync to QA server via SFTP | |
uses: wlixcc/[email protected] | |
with: | |
server: ${{ secrets.QA_FTP_HOST }} | |
username: ${{ secrets.QA_FTP_USER }} | |
password: ${{ secrets.QA_FTP_PASS }} | |
sftp_only: true | |
local_path: './dist/neve/*' | |
remote_path: ${{ secrets.QA_FTP_PATH }} | |
- name: Add SSH Key | |
run: | | |
mkdir $HOME/.ssh | |
echo "$SSH_KEY" > "$HOME/.ssh/key" | |
chmod 600 "$HOME/.ssh/key" | |
- uses: chrnorm/deployment-action@releases/v1 | |
name: Create deployment staging.demosites.io | |
id: deployment | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
target_url: https://staging.demosites.io/neve-3-gb/ | |
environment: staging | |
- name: Deploy to staging.demosites.io | |
run: | | |
rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" "$GITHUB_WORKSPACE/" $SSH_USERNAME@$SSH_HOST:$QA_DS_STAGING_ROOT | |
- name: Update deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@releases/v1 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
target_url: https://staging.demosites.io/neve-3-gb/ | |
state: success | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |