Skip to content

archiver

archiver #1450

Workflow file for this run

name: archiver
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches-ignore: [ main ]
schedule:
- cron: "5 2 * * *" # daily 2:05am UTC
repository_dispatch: # run workflow on api request
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
archive:
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- name: clone this repo
run: git clone https://github.com/tinyweatherforecastgermanygroup/TinyWeatherForecastGermanyArchiver "TinyWeatherForecastGermanyArchiver"
- name: update packages
run: timeout 120s sudo apt update || true
- name: upgrade packages
run: timeout 120s sudo apt upgrade -y || true
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
token: ${{ secrets.GITHUB_TOKEN }}
# cache-dependency-path: requirements.txt
- name: upgrade pip
run: python -m pip install --upgrade pip
- name: install virtualenv
run: pip install virtualenv
- name: list directory contents
run: ls -lisha
- name: init virtualenv
run: virtualenv venv
- name: activate virtualenv
run: source venv/bin/activate
- name: list directory contents
run: ls -lisha
- name: install python requirements
run: pip install -r TinyWeatherForecastGermanyArchiver/requirements.txt
- name: run async wayback machine archiver script
run: timeout 5m python TinyWeatherForecastGermanyArchiver/__init__.py || true
- name: list directory contents
run: ls -lisha
- name: git push to origin
run: |
cd TinyWeatherForecastGermanyArchiver
ls -lisha
git config --local user.name twfgcicdbot
git config --local user.email twfgcicdbot@outlook.com
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git fetch --all
git checkout main
git reset
git add lastmod.txt
git status
git commit -m "archived urls" || true
git push -f origin main || true