Created
February 23, 2020 13:50
-
-
Save veerendra2/e049bbf03637413e94a2632ad3f20781 to your computer and use it in GitHub Desktop.
My Jekyll Site workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/zhujunsan/a0becf82ade50ed06115