forked from ping/newsrack
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (122 loc) · 4.07 KB
/
build.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: "Build"
on:
push:
branches:
- '**'
schedule:
# Customise: Cron interval
- cron: "0 7,12,16,23 * * *"
workflow_dispatch:
inputs:
regenerate:
description: Enter csv of recipe slugs to specifically regenerate
required: false
type: string
skip:
description: Enter csv of recipe slugs to specifically skip
required: false
type: string
verbose:
description: Run recipe in verbose mode
required: false
type: boolean
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.ref_name == github.event.repository.default_branch
# Customise: Total job run time limit
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
timeout-minutes: 1
with:
submodules: true
fetch-depth: 1
- name: Setup node
uses: actions/setup-node@v4
timeout-minutes: 1
with:
node-version: 'lts/*'
- name: Install npm dependencies
timeout-minutes: 1
run: |
npm install --no-fund
- uses: actions/setup-python@v5
timeout-minutes: 1
with:
python-version: '3.10'
- name: Install python requirements
timeout-minutes: 1
run: python -m pip install -r requirements.txt --upgrade
- name: Install calibre's and other dependencies
timeout-minutes: 1
run: sudo apt-fast update -y && sudo apt-fast install --no-install-recommends -y libegl1 libopengl0 imagemagick
- name: Get latest calibre version
id: calibrelatest
run: |
tag="$(curl -L --retry 3 --silent --fail 'https://api.github.com/repos/kovidgoyal/calibre/releases/latest' | jq -r .tag_name)" && \
echo "calibre_ver=${tag#*v}" && \
echo "calibre_ver=${tag#*v}" >> $GITHUB_ENV
- name: Get calibre binaries cache
id: cache-bin
uses: actions/cache@v4
timeout-minutes: 1
with:
path: cache/calibre
key: cache-calibre-x86_64-${{ env.calibre_ver }}
- name: Install calibre
timeout-minutes: 1
run: sh .github/workflows/install_calibre.sh
- name: Download meta artifacts
id: download-meta-artifact
uses: dawidd6/action-download-artifact@v3
timeout-minutes: 1
with:
name: meta-artifacts
path: meta
search_artifacts: true
if_no_artifact_found: warn
- name: Setup Pages
id: setup_pages
uses: actions/configure-pages@v4
timeout-minutes: 1
- name: Generate periodicals
env:
CI_PAGES_URL: ${{ steps.setup_pages.outputs.base_url }}
CALIBRE_CONFIG_DIRECTORY: ${{ github.workspace }}/calibre_config/
regenerate: ${{ github.event.inputs.regenerate }}
skip: ${{ github.event.inputs.skip }}
verbose: ${{ github.event.inputs.verbose }}
accounts: ${{ secrets.accounts }}
run: |
sh build.sh
if [[ -f 'job_summary.md' ]]; then cat 'job_summary.md' >> $GITHUB_STEP_SUMMARY; fi
echo -e "\n<"'!'"-- Commit ${GITHUB_SHA:0:7}, $(ebook-convert --version | head -n1) -->" >> public/index.html
rm -rf "$CALIBRE_CONFIG_DIRECTORY"
# Ref: https://github.com/actions/starter-workflows/blob/main/pages/static.yml
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
timeout-minutes: 2
- uses: actions/upload-artifact@v4
timeout-minutes: 1
with:
name: meta-artifacts
path: meta
if-no-files-found: warn