Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Add files via upload #121

Add files via upload

Add files via upload #121

Workflow file for this run

name: Uploading files to Demo site
on:
push:
branches:
- master
- v2-develop
jobs:
workflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch_name
- name: Set environment variables
run: |
if [[ ${{ steps.get_branch_name.outputs.branch }} == *"master"* ]]; then
echo "SERVER_DIRECTORY=./" >> $GITHUB_ENV
else
echo "SERVER_DIRECTORY=${{ secrets.DEV_DIRECTORY }}" >> $GITHUB_ENV
fi
- name: Replace database config values
run: |
sed -i "s/your_database_host/${{ secrets.SQL_HOST }}/g" inc/config.php
sed -i "s/your_database_username/${{ secrets.SQL_USER }}/g" inc/config.php
sed -i "s/your_database_password/${{ secrets.SQL_PASS }}/g" inc/config.php
sed -i "s/your_database_name/${{ secrets.SQL_DATABASE }}/g" inc/config.php
- name: Upload files
uses: SamKirkland/FTP-Deploy-Action@4.3.0
with:
server: ${{ secrets.SFTP_HOST }}
port: ${{ secrets.SFTP_PORT }}
username: ${{ secrets.SFTP_USER }}
password: ${{ secrets.SFTP_PASS }}
protocol: ftp
local-dir: ./
server-dir: ${{ env.SERVER_DIRECTORY }}
state-name: .ftp-deploy-sync-state-${{ steps.get_branch_name.outputs.branch }}.json