Skip to content

Instantly share code, notes, and snippets.

@TAJD
Created October 8, 2023 14:09
Show Gist options
  • Save TAJD/d8874fd845dd4b909a70047d4e075a4d to your computer and use it in GitHub Desktop.
Save TAJD/d8874fd845dd4b909a70047d4e075a4d to your computer and use it in GitHub Desktop.
GitHub Action to deploy updates to blog
name: Blog build and deploy
on:
push:
branches:
- "gh-actions"
pull_request:
branches:
- "master"
paths:
- ".github/workflows/deploy-site.yaml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_website:
name: "Build website"
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Set up Ruby 💎
uses: ruby/setup-ruby@v1
with:
ruby-version: "3"
bundler-cache: true
- name: Build 🏗
run: bundle exec jekyll build --trace
- name: Copy files to server 📮
run: |
echo "${{secrets.KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chrlvzi --delete \
-e 'ssh -i ./deploy_key -p 22 -o StrictHostKeyChecking=no' \
--exclude '/deploy_key' \
--exclude 'README.md' \
/home/runner/work/personalBlog/personalBlog/_site/ "${{secrets.LOCATIONS}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment