-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (125 loc) · 4.57 KB
/
figshare-processing.yaml
File metadata and controls
141 lines (125 loc) · 4.57 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: figshare-cache
on:
workflow_dispatch:
inputs:
use_author_cache:
description: 'Use cached author data (instead of refreshing)'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
schedule:
- cron: "30 */12 * * *"
push:
branches:
- main
pull_request:
branches:
- main
jobs:
update-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Use Cache in folder ./output
id: cache-restore-output
uses: actions/cache/restore@v5
with:
path: ./output
key: cache-files-${{ github.run_id }}
restore-keys: |
cache-files-
- name: Create output directory if it doesn't exist
run: |
mkdir -p output
find ./output
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: |
git config --global user.name 'L-CAS GitHub'
git config --global user.email 'marc@hanheide.net'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
set -e
python -m pip install --upgrade pip
pip install -r requirements-frozen.txt
- name: Run figshare fetch (Step 1 - Retrieve articles and create CSV)
env:
FIGSHARE_TOKEN: ${{ secrets.FIGSHARE_TOKEN }}
run: |
set -e
cd ./output
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.use_author_cache }}" = "true" ]; then
echo "Running figshare_fetch.py with --use-author-cache (manually triggered)"
python ../figshare_fetch.py --use-author-cache
else
echo "Running figshare_fetch.py without cache (default behavior)"
python ../figshare_fetch.py --rate-limit-delay 1 --max-retries 30
fi
- name: Run figshare bibtex (Step 2 - Generate bibtex from CSV)
run: |
set -e
cd ./output
echo "Running figshare_bibtex.py to generate bibtex from CSV"
python ../figshare_bibtex.py
- name: Save Cache from folder ./output
uses: actions/cache/save@v5
with:
path: ./output
key: ${{ steps.cache-restore-output.outputs.cache-primary-key || 'cache-files' }}
- name: Generate publication statistics
run: |
cd ./output
python ../generate_stats.py --all-csv figshare_articles_all.csv --dedup-csv figshare_articles.csv >> $GITHUB_STEP_SUMMARY
- name: Nexus Repo Publish bibtex
if: ${{ github.event_name != 'pull_request' }}
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: https://lcas.lincoln.ac.uk/repository/
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}
format: raw
repository: misc
coordinates: directory=bibtex
assets: filename=lcas.bib
filename: ./output/lcas.bib
- name: Nexus Repo Publish figshare articles without duplicates CSV
if: ${{ github.event_name != 'pull_request' }}
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: https://lcas.lincoln.ac.uk/repository/
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}
format: raw
repository: misc
coordinates: directory=bibtex
assets: filename=figshare_articles.csv
filename: ./output/figshare_articles.csv
- name: Nexus Repo Publish all figshare articles CSV
if: ${{ github.event_name != 'pull_request' }}
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: https://lcas.lincoln.ac.uk/repository/
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}
format: raw
repository: misc
coordinates: directory=bibtex
assets: filename=figshare_articles_all.csv
filename: ./output/figshare_articles_all.csv
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: outputs
path: |
./output/*.csv
./output/*.bib
retention-days: 30