Skip to content

Publish site

Publish site #376

Workflow file for this run

name: Publish site
on:
push:
branches:
- main
workflow_dispatch:
inputs:
cache:
type: boolean
description: "Don't use jekyll cache"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
files:
- '_data/**'
- '_posts/**'
- '_drafts/**'
- '_series/**'
- name: Checkout theme-files repo
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
repository: genicsblog/theme-files
path: theme
fetch-depth: 1
- name: Setup theme and necessary files
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
run: |
mv theme/* .
rm -rf theme
rm robots.txt
touch .nojekyll
echo "google.com, pub-8114751086331659, DIRECT, f08c47fec0942fa0" >> ads.txt
echo "AWG.LA, 22950318798, DIRECT" >> ads.txt
echo "google.com, pub-9130183266015225, RESELLER, f08c47fec0942fa0" >> ads.txt
- uses: ruby/setup-ruby@v1
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
with:
ruby-version: 2.7.5
bundler-cache: true
- uses: actions/setup-node@v2
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
with:
node-version: '16'
- name: Install npm dependencies
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
run: npm install
- name: Restore/cache .jekyll-cache folder
if: steps.changes.outputs.files == 'true' || github.event.inputs.cache == 'false'
id: jekyll-cache
uses: actions/cache@v3
with:
path: .jekyll-cache
key: ${{ runner.os }}-${{ hashFiles('Gemfile') }}
- name: Build production jekyll site
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
run: JEKYLL_ENV=production NODE_ENV=production bundle exec jekyll build
env:
BEYONDWORDS_API_KEY: ${{ secrets.BEYONDWORDS_API_KEY }}
BEYONDWORDS_PROJECT_ID: ${{ secrets.BEYONDWORDS_PROJECT_ID }}
- name: Deploy site
if: steps.changes.outputs.files == 'true' || github.event_name == 'workflow_dispatch'
uses: cloudflare/pages-action@1
with:
directory: '_site'
projectName: 'genicsblog'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}