-
Notifications
You must be signed in to change notification settings - Fork 5
101 lines (85 loc) · 2.4 KB
/
deploy.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
name: Deploy Repository
on:
# Runs if repository is updated
push:
branches:
- main
paths:
- repository.json
- .github/workflows/deploy.yml
# Runs daily at 00:00 UTC to fetch possible library updates
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
updated: ${{ steps.resolve-repository.outputs.updated }}
steps:
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Checkout repository
id: checkout-repository
uses: actions/checkout@v4
- name: Restore http cache
id: restore-http-cache
uses: actions/cache/restore@v4
with:
path: cache/
key: http-cache
restore-keys: http-cache
- name: Restore asset cache
id: restore-asset-cache
uses: actions/cache/restore@v4
with:
path: _site/channel_v4.json.sha512
key: asset-cache
restore-keys: asset-cache
- name: Resolve repository
id: resolve-repository
env:
GH_USER: ${{secrets.GH_APP_ID}}
GH_PASS: ${{secrets.GH_APP_TOKEN}}
run: python tasks crawl
- name: Setup pages
id: setup-pages
if: steps.resolve-repository.outputs.updated == 'true'
uses: actions/configure-pages@v4
- name: Upload pages
id: upload-pages
if: steps.resolve-repository.outputs.updated == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: _site/
- name: Save http cache
id: save-http-cache
uses: actions/cache/save@v4
if: always()
with:
path: cache/
key: http-cache-${{ hashFiles('cache/*') }}
- name: Save asset cache
id: save-asset-cache
uses: actions/cache/save@v4
if: always()
with:
path: _site/channel_v4.json.sha512
key: asset-cache-${{ hashFiles('_site/channel_v4.json.sha512') }}
deploy:
needs: build
if: needs.build.outputs.updated == 'true'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy pages
id: deployment
uses: actions/deploy-pages@v4