Skip to content

Publish Posts

Publish Posts #23

Workflow file for this run

name: Publish Posts
on:
create:
tags:
repository_dispatch:
types: [post-change-event]
jobs:
build-deploy:
runs-on: ubuntu-latest
name: Publish Website to Staging Server
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "14"
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
tools: composer
- name: Get yarn cache directory path
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn dependencies
uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-
- name: Install yarn dependencies
# as we allow any keys we have to run the installer anyway
# see: https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
# if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Get composer cache directory
id: composer-cache-dir
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
id: composer-cache
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-
- name: Install Composer dependencies
# as we allow any keys we have to run the installer anyway
# if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress
- name: Run build
run: yarn run production
- name: Upload posts
uses: genietim/ftp-action@master
with:
host: sftp://lx3.hoststar.hosting:5544
user: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: ./build_production/blog/
remoteDir: "www.genieblog.ch/public_html/blog/"