1
1
name : deploy
2
2
3
- # Build and deploy the website
4
- # Contains Tenzing's script to update the contributors list
5
- # Contains a script to update the curated resources list
6
-
7
3
on :
8
4
push :
9
5
branches :
12
8
branches :
13
9
- master
14
10
schedule :
15
- - cron : ' 0 0 * * *' # Run daily at midnight
11
+ - cron : ' 0 1 * * *' # 1 AM UTC (1 hour after data processing)
16
12
workflow_dispatch :
17
13
18
14
jobs :
@@ -21,80 +17,52 @@ jobs:
21
17
runs-on : ubuntu-22.04
22
18
permissions :
23
19
contents : read
24
- pull-requests : read
20
+ actions : read # Needed for artifact access
25
21
env :
26
22
HUGO_VERSION : " 0.123.3"
27
23
HUGO_EXTENDED : true
28
- PYTHON_VERSION : " 3.11"
29
24
steps :
30
- - name : Checkout
25
+ - name : Checkout repository
31
26
uses : actions/checkout@v4
32
27
with :
33
28
ref : ${{ github.ref }}
34
29
fetch-depth : 0
35
30
36
- - name : Hugo - Setup
37
- uses : peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f
38
- with :
39
- hugo-version : ${{ env.HUGO_VERSION }}
40
- extended : ${{ env.HUGO_EXTENDED }}
41
-
42
- - name : Python - Setup
43
- uses : actions/setup-python@v5
44
- with :
45
- python-version : ${{ env.PYTHON_VERSION }}
46
- cache : ' pip'
47
-
48
- - name : Cache - Pip Dependencies
49
- id : pip-cache
50
- uses : actions/cache@v4
31
+ - name : Try to download data artifact
32
+ id : download-artifact
33
+ uses : dawidd6/action-download-artifact@v2
34
+ continue-on-error : true
51
35
with :
52
- path : ~/.cache/pip
53
- key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
54
- restore-keys : |
55
- ${{ runner.os }}-pip-
36
+ workflow : data-processing.yml
37
+ name : data-artifact
38
+ path : .
39
+ github_token : ${{ secrets.GITHUB_TOKEN }}
56
40
57
- - name : Python - Install dependencies
41
+ - name : Run data processing if needed
42
+ if : steps.download-artifact.outcome == 'failure'
43
+ env :
44
+ PYTHON_VERSION : " 3.11"
58
45
run : |
46
+ # Install Python dependencies
59
47
python3 -m pip install -r ./requirements.txt
60
-
61
- - name : Python - Tenzing
62
- run : |
48
+
49
+ # Generate data files
63
50
python3 scripts/forrt_contribs/tenzing.py
64
-
65
- - name : Python - Curated Resources
66
- run : |
67
51
python3 content/resources/resource.py
68
-
69
- - name : Script - Move Tenzing's output and validate
70
- run : |
71
52
mv scripts/forrt_contribs/tenzing.md content/contributors/tenzing.md
72
-
73
- if [ ! -f content/contributors/tenzing.md ]; then
74
- echo "tenzing.md not found"
75
- exit 1
53
+
54
+ # Download GA data if possible
55
+ if [ "${{ github.event_name }}" != 'pull_request' ]; then
56
+ python scripts/download_ga_data.py
76
57
fi
77
58
78
- - name : Script - Validate curated resources
79
- run : |
80
- for file in content/curated_resources/*; do
81
- if [ ! -f "$file" ]; then
82
- echo "There is a non-markdown file ( $file ) in the curated resources folder. Exiting."
83
- exit 1
84
- fi
85
- done
86
-
87
- NUM_FILES=$(ls -1 content/curated_resources/*.md | wc -l)
88
- echo "Number of curated resources: $NUM_FILES"
89
-
90
- - name : Download GA Data
91
- if : ${{ github.event_name != 'pull_request' || github.event.inputs.GA_API_CREDENTIALS != '' }}
92
- env :
93
- GA_API_CREDENTIALS : ${{ secrets.GA_API_CREDENTIALS }}
94
- GA_PROPERTY_ID : ${{ secrets.GA_PROPERTY_ID }}
95
- run : python scripts/download_ga_data.py
59
+ - name : Setup Hugo
60
+ uses : peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f
61
+ with :
62
+ hugo-version : ${{ env.HUGO_VERSION }}
63
+ extended : ${{ env.HUGO_EXTENDED }}
96
64
97
- - name : Hugo - Build
65
+ - name : Build site
98
66
run : |
99
67
if [ "$BRANCH" != 'refs/heads/master' ]; then
100
68
hugo --gc --minify --cleanDestinationDir --destination public --baseURL https://staging.forrt.org
@@ -104,15 +72,13 @@ jobs:
104
72
env :
105
73
BRANCH : ${{ github.ref }}
106
74
107
- - name : Upload Artifact - Website
75
+ - name : Upload site artifact
108
76
uses : actions/upload-artifact@v4
109
- env :
110
- ARTIFACT_NAME : forrt-website-${{ github.run_number }}
111
77
with :
112
- name : ${{ env.ARTIFACT_NAME }}
78
+ name : forrt-website- ${{ github.run_number }}
113
79
path : public/
114
80
retention-days : 1
115
-
81
+
116
82
deploy-test :
117
83
name : Deploy - Test
118
84
runs-on : ubuntu-22.04
0 commit comments