Skip to content

Build and Deploy Demo Site #1

Build and Deploy Demo Site

Build and Deploy Demo Site #1

Workflow file for this run

name: Build and Deploy Demo Site
on:
# Run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy_demo_site:
runs-on: "ubuntu-latest"
env:
BUNDLE_PATH: "vendor/bundle"
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: jekyll/minima
ref: demo-site
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Clone target branch
run: |
REMOTE_BRANCH="${REMOTE_BRANCH:-gh-pages}"
REMOTE_REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
echo "Publishing to ${GITHUB_REPOSITORY} on branch ${REMOTE_BRANCH}"
rm -rf _site/
git clone --depth=1 --branch="${REMOTE_BRANCH}" --single-branch --no-checkout "${REMOTE_REPO}" _site/
- name: Build site
run: bundle exec jekyll build --verbose --trace
- name: Deploy to GitHub Pages
run: |
SOURCE_COMMIT="$(git log -1 --pretty="%an: %B" "$GITHUB_SHA")"
pushd _site &>/dev/null
: > .nojekyll
git add --all
git -c user.name="${GITHUB_ACTOR}" -c user.email="${GITHUB_ACTOR}@users.noreply.github.com" \
commit --quiet \
--message "Deploy demo-site from ${GITHUB_SHA}" \
--message "$SOURCE_COMMIT"
git push
popd &>/dev/null