Skip to content

Commit

Permalink
GitHub Actions rewritten
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap committed Jan 2, 2020
1 parent 85bb42c commit 170221d
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 89 deletions.
129 changes: 40 additions & 89 deletions .github/workflows/hugo-build.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,48 @@
name: "hugo-build"
name: hugo-build

on:
pull_request:
types: [opened, synchronize]
push:
branches: [master]

jobs:
markdown-lint-check:
name: "Markdown lint check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: "Install markdownlint-cli"
run: npm install -g markdownlint-cli

- name: "Create markdownlint configuration file"
run: |
echo "{ MD013: { code_blocks: false } }" > /tmp/markdownlint_config.json
- name: "Run markdownlint"
run: find . -path ./themes -prune -o -path ./node_modules -prune -o -name "*.md" -print0 | xargs -t -0 markdownlint -c /tmp/markdownlint_config.json

markdown-spell-check:
name: "Markdown spell check"
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- name: "Install Node.js 12"
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: "Install markdown-spellcheck"
run: npm install -g markdown-spellcheck

- name: "Run mdspell"
run: mdspell '**/*.md' '!**/node_modules/**/*.md' '!**/themes/**/*.md' --ignore-numbers --ignore-acronyms --report --en-gb

hugo-build:
name: "Hugo build"
runs-on: ubuntu-18.04
needs:
- markdown-lint-check
- markdown-spell-check

steps:
- uses: actions/checkout@v2

- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.3.2
with:
hugo-version: '0.60.1'

- name: Build
run: |
hugo --gc
cp LICENSE README.md public/
echo ${GITHUB_REPOSITORY##*/} > public/CNAME
- name: "Check links"
run: |
echo "127.0.0.1 ${GITHUB_REPOSITORY##*/}" | sudo tee -a /etc/hosts
curl -s https://getcaddy.com | bash -s personal
cat > Caddyfile << EOF
https://${GITHUB_REPOSITORY##*/}
root public
tls self_signed
EOF
sudo caddy -quiet &
go get -u github.com/raviqqe/muffet
~/go/bin/muffet --concurrency=10 --skip-tls-verification --buffer-size=8192 --exclude "https://www.linkedin.com/in/petrruzicka/" https://${GITHUB_REPOSITORY##*/}
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.8.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: public/
with:
emptyCommits: false
forceOrphan: true
- uses: actions/checkout@v2

- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.3.2
with:
hugo-version: '0.62.0'

- name: Build
run: |
hugo --gc
cp LICENSE README.md public/
echo "${{ github.event.repository.name }}" > public/CNAME
- name: Check broken links
env:
INPUT_URL: https://${{ github.event.repository.name }}
INPUT_PAGES_PATH: public
INPUT_CMD_PARAMS: --buffer-size=8192 --concurrency=10 --skip-tls-verification --exclude=https://www.linkedin.com/in/petrruzicka/
run: |
wget -qO- https://raw.githubusercontent.com/ruzickap/action-broken-link-checker/v1/entrypoint.sh | bash
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.8.0
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: public
with:
forceOrphan: true
34 changes: 34 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: markdown

on:
pull_request:
types: [opened, synchronize]
push:

jobs:
markdownlint-check:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v1.1.1
with:
files: .
config_file: .markdownlint.yml

markdown-spell-check:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Install Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install markdown-spellcheck
run: npm install -g markdown-spellcheck

- name: Run mdspell
run: find . -type f -name "*.md" -exec mdspell --ignore-numbers --ignore-acronyms --report --en-gb {} \;
15 changes: 15 additions & 0 deletions .github/workflows/periodic-broken-links-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: periodic-broken-links-check

on:
schedule:
- cron: '8 8 * * 2'

jobs:
broken-link-checker:
runs-on: ubuntu-18.04
steps:
- name: Broken link checker
run: |
export INPUT_URL="https://${GITHUB_REPOSITORY##*/}"
export INPUT_CMD_PARAMS="--buffer-size=8192 --concurrency=10 --exclude=https://www.linkedin.com/in/petrruzicka/"
wget -qO- https://raw.githubusercontent.com/ruzickap/action-broken-link-checker/v1/entrypoint.sh | bash
23 changes: 23 additions & 0 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: yamllint

on:
pull_request:
types: [opened, synchronize]
paths:
- '**.yml'
- '**.yaml'
push:
paths:
- '**.yml'
- '**.yaml'

jobs:
yamllint-check:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: yamllint
uses: ibiqlik/action-yamllint@master
with:
file_or_dir: .
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD013:
code_blocks: false
tables: false
7 changes: 7 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: default

rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 80
level: warning

0 comments on commit 170221d

Please sign in to comment.