-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (62 loc) · 2.34 KB
/
archiver.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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 [email protected]
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