Skip to content

Mirror Site

Mirror Site #116

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@v4
- 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).*|xmlrpc\.php$' --wait 1 https://www.dcpbk.org/
- name: Download 404
run: wget --content-on-error --directory-prefix="www" https://www.dcpbk.org/404.html || echo "Expexted error"
- name: Setup Pages
uses: actions/configure-pages@v5
# 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 -E 's|https?:(\\?)/(\\?)/www\.dcpbk\.org|https:\1/\2/mwt.github.io/static-dcpbk|g' {} \;
- name: Copy robots.txt
run: cp robots.txt dist/
# Start upload
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4