A deploy workflow plugin used by Electric Book projects with automated deploys to a web server with FTP or SSH access.
Create .github/workflows/deploy-ftp-ssh.yml in your Electric Book project and/or media repo:
name: Deploy to web server with FTP or SSH
on:
push: # Trigger on any push, but branch validation will filter
workflow_dispatch: # Allow manual triggering
jobs:
deploy:
uses: electricbookworks/electric-book-deploy-workflow-ftp-ssh/.github/workflows/deploy.yml@{release-version}
secrets: inheritReplace {release-version} with the latest release (e.g. v2.0.0), unless you want to use an older version.
You can also add the following optional inputs:
name: Deploy to web server with FTP or SSH
on:
push: # Trigger on any push, but branch validation will filter
workflow_dispatch: # Allow manual triggering
jobs:
deploy:
uses: electricbookworks/electric-book-deploy-workflow-ftp-ssh/.github/workflows/deploy.yml@{release-version}
secrets: inherit
with:
config-file: '.github/workflows/deploy.config.json' # optional - defaults to '.github/workflows/deploy.config.json'
node-version: '22' # optional - defaults to 22
ruby-version: '3.2' # optional - defaults to 3.2
setup-command: 'npm run setup' # optional - defaults to 'npm run setup'
build-command: 'npm run eb -- output --baseurl="${BASEURL}" --configs="${FULL_CONFIGS}" --dontserve=true --deploy=true' # optional - defaults to 'npm run eb -- output --baseurl="${BASEURL}" --configs="${FULL_CONFIGS}" --dontserve=true --deploy=true'Create .github/workflows/deploy.config.json:
{
"ftp-ssh": {
"configs-comment": "All configs are relative to the _configs folder.",
"configs": ["_config.live.yml"],
"builds": [
{
"configs": [],
"dir": ""
},
{
"configs": ["_config.audience-1.yml"],
"dir": "audience/1"
},
{
"configs": ["_config.audience-2.yml"],
"dir": "audience/2"
}
],
"path-comment": "The contents of the paths defined below will be completely replaced on the server by the builds output. So make sure the path is dedicated to this deployment.",
"live":{
"type": "ftp",
"web-root": "public_html",
"path": ""
},
"staging": {
"configs-comment": "Branch-specific configs property overrides any top-level configs.",
"configs": ["_config.staging.yml"],
"type": "ssh",
"web-root": "public_html",
"path": ""
},
"media": {
"repo": "owner-name/repo-name",
"dirs": [
"assets/images/web"
]
},
"media-global": {
"repo": "owner-name/repo-name",
"destination": "media",
"dirs": [
"assets/images/web",
"downloads"
]
}
}
}This workflow depends on the follwoing secrets being defined either at the organisation level or on the consuming repo:
DEPLOY_SSH_PRIVATE_KEY- the corresponding public key needs to be added to the web server'sauthorized_keys.DEPLOY_FTP_PASSWORDDEPLOY_HOST_LIVEDEPLOY_HOST_STAGINGDEPLOY_PORT_LIVEDEPLOY_PORT_STAGINGDEPLOY_USERNAME_LIVEDEPLOY_USERNAME_STAGING