-
Notifications
You must be signed in to change notification settings - Fork 3
203 lines (185 loc) · 4.78 KB
/
pib_min.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: PIB_India_Ministry
on:
workflow_dispatch:
inputs:
desc:
description: 'Enter the appropriate data in the following sections'
default: 'DO NOT EDIT THIS LEAVE THIS AS IS'
intialDate:
description: 'Intial Date in yyyy-mm-dd format'
required: true
type: string
lastDate:
description: 'Last Date in yyyy-mm-dd format'
required: true
type: string
customTag:
description: 'make a custom tag for zip in format. Do not put special character or spaces. eg PIB_India_FinMin and so on'
required: true
default: 'PIB_Custom_Tag'
type: string
ministrycode:
description: 'Enter the ministry code
(Find the ministry code from ministries.txt file)'
required: true
default: 0
type: choice
options:
- 0
- 1
- 2
- 3
- 61
- 62
- 63
- 68
- 70
- 71
- 75
- 80
- 72
- 14
- 45
- 56
- 35
- 1330
- 27
- 58
- 41
- 26
- 42
- 16
- 24
- 60
- 39
- 1440
- 66
- 17
- 33
- 57
- 48
- 73
- 67
- 8
- 1323
- 30
- 4
- 15
- 1340
- 40
- 31
- 53
- 5
- 47
- 11
- 1336
- 21
- 7
- 51
- 44
- 65
- 28
- 59
- 10
- 12
- 6
- 20
- 79
- 52
- 23
- 69
- 43
- 13
- 46
- 77
- 50
- 55
- 18
- 25
- 19
- 36
- 49
- 32
- 38
- 64
- 9
- 78
- 1325
- 74
- 34
- 37
- 1005
- 1406
- 1454
- 1458
- 1470
- 1484
jobs:
pib_articles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setting_up
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
sudo apt update
sudo apt install --fix-missing -y python3 wkhtmltopdf fd-find poppler-utils
sudo ln -s $(which fdfind) /usr/bin/fd
sudo pip install -r requirements.txt
mkdir -p /home/runner/zips/{text,monthly,daily}
sudo pip install -U pyopenssl cryptography
- name: set env
run: |
echo ${{ inputs.customTag }}
echo PIB_TAG=${{ inputs.customTag }} >> $GITHUB_ENV
- name: run script
run: |
source .env
pib_min ${{ inputs.intialDate }} ${{ inputs.lastDate }} ${{ inputs.ministrycode }} || err_handle "10" "Spider failed to run"
- name: make txt files
run: |
source .env
pdftxt
- name: zipup_months_articles
run: |
source .env
cd /home/runner/
zip -r "/home/runner/zips/monthly/PIB_${{ env.PIB_TAG }}.zip" pib || err_handle "13" "Failed to create PIB_${{ env.PIB_TAG }}.zip"
- name: zipup_months_articles_by_days
run: |
source .env
cd /home/runner
for day in pib/*/*/*; do
echo $day
dayname=$(basename $day)
monthdir=$(dirname $day)
monthname=$(basename $monthdir)
yeardir=$(dirname $monthdir)
yearname=$(basename $yeardir)
zip -r "/home/runner/zips/daily/PIB_${dayname}_${monthname}_${yearname}_${{ env.PIB_TAG }}.zip" $day || err_handle "13" "Failed to create PIB_${dayname}_${{ env.PIB_TAG }}.zip"
done
- name: Create Monthly zip
uses: ncipollo/release-action@v1.14.0
with:
artifacts: "/home/runner/zips/monthly/*.zip"
token: ${{ secrets.PIB }}
tag: "PIB_All_${{ env.PIB_TAG }}"
allowUpdates: true
body : "PIB articles from ${{ inputs.intialDate }} to ${{ inputs.lastDate }}"
- name: Create Daily zips
uses: ncipollo/release-action@v1.14.0
with:
artifacts: "/home/runner/zips/daily/*.zip"
token: ${{ secrets.PIB }}
tag: "PIB_Daily_${{ env.PIB_TAG }}"
allowUpdates: true
body : "PIB articles (by date) from ${{ inputs.intialDate }} to ${{ inputs.lastDate }}"
- name: Create Link text files
uses: ncipollo/release-action@v1.14.0
with:
artifacts: "/home/runner/piblinks/*.txt"
token: ${{ secrets.PIB }}
tag: "PIB_Links_${{ env.PIB_TAG }}"
allowUpdates: true
body : "PIB articles links from ${{ inputs.intialDate }} to ${{ inputs.lastDate }}"