Skip to content

Mirror Site

Mirror Site #3677

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Mirror Site
# Controls when the workflow will run
on:
schedule:
- cron: "11 21 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
#- name: Restore the file attrs (mtime)
# run: |
# if [ -d "www" ]
# then
# .github/bin/save-file-attrs.py restore
# else
# mkdir www
# fi
- name: Download the files
run: wget -m --retry-connrefused --tries=20 --no-host-directories --directory-prefix="www" --exclude-directories="/wp-json,/wp-admin" --regex-type 'pcre' --reject-regex '.*\?(?!ver).*' --wait 1 https://chriskthomas.com/
- name: Download 404
run: wget --content-on-error --directory-prefix="www" https://chriskthomas.com/404.html || echo "Expexted error"
#- name: Save the file attrs
# run: .github/bin/save-file-attrs.py save
#- name: Commit files
# run: |
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git add -- ./www
# git diff-index --cached --quiet HEAD -- || git add .saved-file-attrs
# git commit -m "automatically update site" || echo "Error (probably no changes to commit)"
#- name: Push changes
# run: git push
- name: Setup Pages
uses: actions/configure-pages@v3
# Start post-processing
- name: Make dist folder and copy files
run: mkdir -p dist && cp -r www/* dist/
- name: Remove query strings from file names
run: .github/bin/cleanup-querystrings.py
- name: Replace text
run: find ./dist/ -type f -exec sed -i "s/https:\/\/chriskthomas.com\/\?/\//g" {} \;
- name: Copy robots.txt
run: cp robots.txt dist/
# Start upload
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2