forked from polifonia-project/ecosystem
-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (121 loc) · 4.45 KB
/
reeco_initialize.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
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
name: initialize reeco
on: [push]
# schedule:
# - cron: '25 9 * * *' # '0 0 * * 1' At 00:00 on Monday
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v3
- name: setup github user
run: |
git config --global user.email "[email protected]"
git config --global user.name "enrico daga"
- name: check if repositories.txt exists in this repo
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "repositories.txt"
- name: repositories.txt exists, read and update submodules
if: steps.check_files.outputs.files_exists == 'true'
id: split_repos
env:
ACCESS_TOKEN: ${{ secrets.MY_TOKEN }}
run: |
git rm -r --ignore-unmatch content
while IFS= read -r line; do
echo "Text read from file: $line"
IN="$line"
[ -z "$line" ] && continue
arrIN=(${IN//:/ })
repo=${arrIN[0]}
version=${arrIN[2]}
echo "repo: $repo"
echo "version: $version"
rm -rf "content/_$repo"
git clone -n "https://github.com/$repo" "content/_$repo"
cd "content/_$repo"
git ls-tree -r "$version" --full-tree --name-only | grep "\.md" > files.tmp
while IFS= read -r line; do
git checkout "$version" "$line" || echo "WARNING: error checking out $line"
sed -i 's#{{#{% raw %}{{{% endraw %}#g' "$line" || echo ""
done < files.tmp
rm files.tmp
rm -rf .git
rm -rf .github
cd -
done < repositories.txt
./generate-repo-data.sh
- name: repositories.txt does not exist, check if an issue already exists
if: steps.check_files.outputs.files_exists == 'false'
uses: nickderobertis/check-if-issue-exists-action@master
id: check_if_issue_exists
with:
repo: ${{ github.event.repository.name }}
token: ${{ github.token }}
title: missing repositories.txt
labels: bug
- name: repositories.txt and issue do not exist, create an issue
if: steps.check_files.outputs.files_exists == 'false' && steps.check_if_issue_exists.outputs.exists == 'false'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
filename: .github/initialize.md
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: validate yaml headings in md files
id: validate_yml
run: python validate.py
- name: build RDF data files
id: build_rdf_data_files
run: |
pip install pysparql-anything
python build_rdf_data_files.py
- name: get current date
id: date
run: echo "::set-output name=date::$(date +'%Y_%m_%d_%H-%M')"
- name: commit and push report
uses: Andro999b/[email protected]
with:
github_token: ${{ github.token }}
branch: main
force: true
message: new report - ${{ steps.date.outputs.date }}
- name: check releases, zenodo sync, write report, PR zenodo.json to repos
id: releases_zenodo
run: python releases_zenodo.py
env:
TOKEN: ${{ github.token }}
- name: write release report file
uses: "DamianReeves/write-file-action@master"
with:
path: releases/${{ steps.date.outputs.date }}_report.json
write-mode: overwrite
contents: ${{ steps.releases_zenodo.outputs.releases_report }}
- name: commit and push report
uses: Andro999b/[email protected]
with:
github_token: ${{ github.token }}
branch: main
force: true
message: new release report - ${{ steps.date.outputs.date }}
#- name: transform valid data and releases to RDF and store
# todo
# - name: setup python
# uses: actions/setup-python@v4
# with:
# python-version: '3.9' # install the python version needed
# - name: install python packages
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# - name: execute py script # run main.py
# run: python initialize.py