-
Notifications
You must be signed in to change notification settings - Fork 2
166 lines (143 loc) · 4.85 KB
/
deploy.yaml
File metadata and controls
166 lines (143 loc) · 4.85 KB
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
name: Deploy Docs
on:
push:
branches: [main]
schedule:
- cron: "0 */6 * * *" # Every 6 hours
workflow_dispatch:
repository_dispatch:
types: [status-update]
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: daemonless
- uses: actions/checkout@v6
with:
path: daemonless-io
- uses: actions/checkout@v6
with:
repository: daemonless/daemonless
token: ${{ steps.app-token.outputs.token }}
path: daemonless
- uses: actions/checkout@v6
with:
repository: daemonless/dbuild
path: dbuild
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: |
cd daemonless-io
pip install -r requirements.txt
- name: Fetch repositories
env:
GH_TOKEN: ${{ github.token }}
run: |
cd daemonless-io
make fetch
- name: Generate documentation
env:
GH_TOKEN: ${{ github.token }}
run: |
cd daemonless-io
make generate
- name: Commit generated changes
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
# Commit to daemonless-io
cd daemonless-io
git config user.name "daemonless-bot[bot]"
git config user.email "3247603+daemonless-bot[bot]@users.noreply.github.com"
git add mkdocs.yaml
git diff --staged --quiet || git commit -m "Update generated docs and status [skip ci]"
git push
# Commit to daemonless/daemonless (Org README)
cd ../daemonless
git config user.name "daemonless-bot[bot]"
git config user.email "3247603+daemonless-bot[bot]@users.noreply.github.com"
git add README.md
git diff --staged --quiet || git commit -m "Update Org README from daemonless-io [skip ci]"
git push
- name: Build site
run: |
cd daemonless-io
make build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: daemonless-io/site/
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
- name: Checkout
uses: actions/checkout@v6
- name: Notify Discord on outdated images
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_VERSION_WEBHOOK }}
GH_TOKEN: ${{ github.token }}
run: |
set +e
python3 scripts/compare-versions.py > /tmp/versions.json 2>/dev/null
EXIT=$?
set -e
if [ $EXIT -eq 0 ] || [ -z "$DISCORD_WEBHOOK" ] || [ ! -s /tmp/versions.json ]; then
exit 0
fi
COUNT=$(jq '.summary.outdated_count // 0' /tmp/versions.json)
if [ "$COUNT" -eq 0 ]; then
exit 0
fi
DESCRIPTION=$(jq -r '
.outdated[] as $item |
(.base_names[$item.name] // $item.name) as $base |
"**[\($item.name)](https://daemonless.io/images/\($item.name))**: " +
($item.updates | map(
"[\(.tag)](https://github.com/daemonless/\($base)/actions/workflows/build.yaml) `\(.deployed) → \(.available)`"
) | join(", "))
' /tmp/versions.json | awk '{printf "%s\\n", $0}')
curl -s -X POST "$DISCORD_WEBHOOK" \
-H "Content-Type: application/json" \
-d "$(jq -n \
--arg desc "$DESCRIPTION" \
--arg count "$COUNT" \
'{embeds: [{title: "🔄 \($count) outdated image(s)", description: $desc, color: 16744272}]}')"
- name: Ping IndexNow
run: |
curl -s -X POST "https://api.indexnow.org/indexnow" \
-H "Content-Type: application/json" \
-d '{
"host": "daemonless.io",
"key": "9165b253e91b4c86a023f24a2335428b",
"keyLocation": "https://daemonless.io/9165b253e91b4c86a023f24a2335428b.txt",
"urlList": [
"https://daemonless.io/",
"https://daemonless.io/status/",
"https://daemonless.io/images/",
"https://daemonless.io/guides/quick-start/",
"https://daemonless.io/guides/dbuild/",
"https://daemonless.io/community/",
"https://daemonless.io/philosophy/"
]
}'