Skip to content

Instantly share code, notes, and snippets.

@veerendra2
Created February 23, 2020 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veerendra2/e049bbf03637413e94a2632ad3f20781 to your computer and use it in GitHub Desktop.
Save veerendra2/e049bbf03637413e94a2632ad3f20781 to your computer and use it in GitHub Desktop.
My Jekyll Site workflow
name: Jekyll site CI/CD
on:
push:
branches:
- source
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cloning source branch
uses: actions/checkout@v2
with:
ref: 'source'
path: 'source'
- name: Building site in the jekyll/builder container
run: |
docker run \
-v ${{ github.workspace }}/source:/srv/jekyll -v ${{ github.workspace }}/source/_site:/srv/jekyll/_site \
veerendrav2/my-jekyll:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future"
- name: Cloning master branch
uses: actions/checkout@v2
with:
ref: 'master'
path: 'master'
- name: Copying _site content to master branch repo
run: cp -R ${{ github.workspace }}/source/_site/* ${{ github.workspace }}/master
- name: Commit files
run: |
cd ${{ github.workspace }}/master
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add *
git commit -m "New changes" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
directory: ${{ github.workspace }}/master
branch: 'master'
github_token: ${{ secrets.GITHUB_TOKEN }}
@veerendra2
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment