mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
The misspell tool that we used previously has no exclude switch for ignoring translated files. Also, it looks like it is not maintained anymore. In addition to changing our spell checker, this commit renames the `Build Site` workflow to `Blog` (to be consistent with our `Code` workflow).
121 lines
3.1 KiB
YAML
121 lines
3.1 KiB
YAML
name: Blog
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
- '!staging.tmp'
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
schedule:
|
|
- cron: '0 0 1/4 * *' # every 4 days
|
|
|
|
jobs:
|
|
build_site:
|
|
name: "Zola Build"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: 'Download Zola'
|
|
run: curl -sL https://github.com/getzola/zola/releases/download/v0.12.1/zola-v0.12.1-x86_64-unknown-linux-gnu.tar.gz | tar zxv
|
|
- name: 'Install Python Libraries'
|
|
run: python -m pip install --user -r requirements.txt
|
|
working-directory: "blog"
|
|
|
|
- name: "Run before_build.py script"
|
|
run: python before_build.py
|
|
working-directory: "blog"
|
|
- name: "Build Site"
|
|
run: ../zola build
|
|
working-directory: "blog"
|
|
|
|
- name: Upload Generated Site
|
|
uses: actions/upload-artifact@v1.0.0
|
|
with:
|
|
name: generated_site
|
|
path: blog/public
|
|
|
|
zola_check:
|
|
name: "Zola Check"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: 'Download Zola'
|
|
run: curl -sL https://github.com/getzola/zola/releases/download/v0.12.1/zola-v0.12.1-x86_64-unknown-linux-gnu.tar.gz | tar zxv
|
|
|
|
- name: "Run zola check"
|
|
run: ../zola check
|
|
working-directory: "blog"
|
|
|
|
check_spelling:
|
|
name: "Check Spelling"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Typo Check
|
|
uses: crate-ci/typos@v1.1.9
|
|
with:
|
|
files: blog
|
|
|
|
deploy_site:
|
|
name: "Deploy Generated Site"
|
|
runs-on: ubuntu-latest
|
|
needs: [build_site, check_spelling]
|
|
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule')
|
|
|
|
steps:
|
|
- name: "Download Generated Site"
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: generated_site
|
|
|
|
- name: Setup SSH Keys and known_hosts
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
|
|
ssh-add - <<< "$deploy_key"
|
|
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
|
|
env:
|
|
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
|
deploy_key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
|
|
- name: "Clone blog_os_deploy Repo"
|
|
run: git clone git@github.com:phil-opp/blog_os_deploy.git --branch gh-pages
|
|
|
|
- name: "Set Up Git Identity"
|
|
run: |
|
|
git config --local user.name "GitHub Actions Deploy"
|
|
git config --local user.email "github-actions-deploy@phil-opp.com"
|
|
working-directory: "blog_os_deploy"
|
|
|
|
- name: "Delete Old Content"
|
|
run: "rm -r ./*"
|
|
working-directory: "blog_os_deploy"
|
|
|
|
- name: "Add New Content"
|
|
run: cp -r generated_site/* blog_os_deploy
|
|
|
|
- name: "Commit New Content"
|
|
run: |
|
|
git add .
|
|
git commit --allow-empty -m "Deploy ${GITHUB_SHA}
|
|
|
|
Deploy of commit https://github.com/phil-opp/blog_os/commit/${GITHUB_SHA}"
|
|
working-directory: "blog_os_deploy"
|
|
|
|
- name: "Show Changes"
|
|
run: "git show"
|
|
working-directory: "blog_os_deploy"
|
|
|
|
- name: "Push Changes"
|
|
run: "git push"
|
|
working-directory: "blog_os_deploy"
|