Skip to content

Commit

Permalink
Merge pull request #45 from Dasharo/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
pre-commit: autoupdate hooks
  • Loading branch information
pietrushnic authored Jan 29, 2024
2 parents 73eb438 + d415656 commit 6978ddc
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Hugo setup
uses: peaceiris/[email protected]
with:
hugo-version: "0.105.0"
hugo-version: "0.111.3"
extended: true

- uses: actions/cache@v2
- uses: actions/cache@v4.0.0
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
Expand All @@ -35,7 +35,7 @@ jobs:
run: hugo --minify

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v3.9.3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/seo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.8.0
uses: lycheeverse/lychee-action@v1.9.2
with:
fail: true
args: --max-redirects 10 -a 403,500,503 .
Expand All @@ -24,17 +24,17 @@ jobs:
name: Check orphan pages
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
submodules: true

- name: Checkout SEO Spy
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
repository: 3mdeb/seo-spy
path: seo-spy

- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.9'

Expand All @@ -44,7 +44,7 @@ jobs:
pip install -r seo-spy/requirements.txt
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v2.6.0
with:
extended: true

Expand All @@ -64,17 +64,17 @@ jobs:
name: Check canonical links
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
submodules: true

- name: Checkout SEO Spy
uses: actions/checkout@v3
uses: actions/checkout@v4.1.1
with:
repository: 3mdeb/seo-spy
path: seo-spy

- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.9'

Expand All @@ -84,7 +84,7 @@ jobs:
pip install -r seo-spy/requirements.txt
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v2.6.0
with:
extended: true

Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
Expand All @@ -13,13 +13,13 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
args: [-c=.yamllint]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.34.0
rev: v0.38.0
hooks:
- id: markdownlint
- id: markdownlint-fix
Expand All @@ -32,7 +32,7 @@ repos:
- commit-msg

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.6
hooks:
- id: codespell

Expand Down
72 changes: 72 additions & 0 deletions scripts/docker-host-preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

# Check for the required parameters
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <user@remote-host> <local-src-dir>"
exit 1
fi

# Function to clean up background processes when the script exits
cleanup() {
echo "Cleaning up..."
# Kill the inotifywait background process
kill $INOTIFY_PID
}

# Set trap to call cleanup function when the script exits
trap cleanup exit

REMOTE_USER_HOST="$1"
LOCAL_SRC_DIR="$2" # Local source directory provided as the second parameter
REMOTE_SRC_DIR="/tmp/3mdeb-website"
DOCKER_IMAGE="klakegg/hugo:0.111.3-ext-alpine"
DOCKER_PORT="1313"
REMOTE_HOST=$(echo $REMOTE_USER_HOST | cut -d '@' -f2)

# Set DOCKER_HOST environment variable
export DOCKER_HOST="tcp://$REMOTE_HOST:2375"

# Function to continuously sync local directory with remote directory
start_sync() {
ssh $REMOTE_USER_HOST "rm -rf $REMOTE_SRC_DIR"
rsync -avz --exclude='.git/' $LOCAL_SRC_DIR $REMOTE_USER_HOST:$REMOTE_SRC_DIR
inotifywait -m -r -e modify,create,delete --exclude '^\.git/' --format '%w%f' $LOCAL_SRC_DIR | while read file; do
# Check if the changed file is not inside .git directory
if [[ $file != *".git"* ]]; then
rsync -avz --exclude='.git/' $LOCAL_SRC_DIR $REMOTE_USER_HOST:$REMOTE_SRC_DIR
fi
done &
INOTIFY_PID=$!
}

# Function to run Docker container on remote host
run_docker_container() {
docker run --rm -it -v $REMOTE_SRC_DIR:/src -p $DOCKER_PORT:$DOCKER_PORT -u $(id -u) $DOCKER_IMAGE serve -b $REMOTE_HOST
}

#!/bin/bash

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Check for required commands
if ! command_exists rsync; then
echo "rsync is not installed. Please install it."
exit 1
fi

if ! command_exists inotifywait; then
echo "inotify-tools is not installed. Please install it."
exit 1
fi

# Start continuous synchronization in the background
start_sync

# Run Docker container
run_docker_container

# After the Docker container exits, kill the background sync process
kill $!
2 changes: 0 additions & 2 deletions themes/dasharo/layouts/partials/essentials/style.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="preconnect" href="//ajax.googleapis.com">
<link rel="preconnect" href="https://fonts.google.com" crossorigin="anonymous">
<link rel="preconnect" href="https://use.fontawesome.com" crossorigin>
<link rel="preconnect" href="//cdnjs.cloudflare.com">
<link rel="preconnect" href="//www.googletagmanager.com">
<link rel="preconnect" href="//www.google-analytics.com">
<link rel="dns-prefetch" href="https://fonts.google.com">
<link rel="dns-prefetch" href="https://use.fontawesome.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
<link rel="dns-prefetch" href="//www.googletagmanager.com">
Expand Down

0 comments on commit 6978ddc

Please sign in to comment.