Skip to content

CI

CI #395

Workflow file for this run

name: CI
on:
workflow_dispatch:
schedule:
# Run at 2 AM UTC every day
# - cron: 0 2 * * *
# Run at 2 AM UTC every Monday
- cron: 0 2 * * 1
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- name: Creates a bookshelf based on Goodreads data
run: npm start
env:
GOODREADS_KEY: ${{ secrets.GOODREADS_KEY }}
GOODREADS_USER: ${{ secrets.GOODREADS_USER }}
GOODREADS_SHELF: ${{ secrets.GOODREADS_SHELF }}
- name: Commits generated bookshelf to GitHub pages
env:
GIT_OWNER_EMAIL: ${{ secrets.GIT_OWNER_EMAIL }}
GITHUB_PUSH_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
run: |
git config user.email "$GIT_OWNER_EMAIL"
git config user.name "gnclmorais"
git status --porcelain
if [[ `git status --porcelain` ]]; then
git add index.html
git add CNAME LICENSE
git commit -a -m "Update bookshelf at `date +'%Y-%m-%d'`"
git remote rm origin
git remote add origin https://gnclmorais:[email protected]/gnclmorais/bookshelf.git
git push --force origin HEAD:gh-pages
else
echo 'Unable to detect changes'
fi