Skip to content

Commit 50a1ef6

Browse files
authored
Merge branch 'ep2025' into ep2025-sponsors-cards
2 parents bb89b0f + 5e765b3 commit 50a1ef6

File tree

8 files changed

+133
-55
lines changed

8 files changed

+133
-55
lines changed

.github/workflows/build-deploy.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ jobs:
3333
- name: Install dependencies
3434
run: make install
3535

36-
- name: Build the website
37-
run: make build MODE=production
38-
3936
- name: Set up SSH key
4037
uses: webfactory/[email protected]
4138
with:
@@ -44,5 +41,7 @@ jobs:
4441
- name: ssh keyscan
4542
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts
4643

47-
- name: Deploy to server
44+
- name: Build and Deploy to server
45+
env:
46+
MODE: "production"
4847
run: make deploy FORCE_DEPLOY=true

.github/workflows/preview.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ jobs:
3636
- name: Install dependencies
3737
run: make install
3838

39-
- name: Build the website
40-
env:
41-
BRANCH: "${{ env.GITHUB_BRANCH_NAME }}"
42-
GIT_VERSION: "${{ env.GITHUB_COMMIT_HASH }}"
43-
MODE: "preview"
44-
run: make build
45-
4639
- name: Set up SSH key
4740
uses: webfactory/[email protected]
4841
with:
@@ -51,9 +44,11 @@ jobs:
5144
- name: ssh keyscan
5245
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts
5346

54-
- name: Upload preview
47+
- name: Build and upload preview
5548
env:
5649
BRANCH: "${{ env.GITHUB_BRANCH_NAME }}"
50+
GIT_VERSION: "${{ env.GITHUB_COMMIT_HASH }}"
51+
MODE: "preview"
5752
run: make preview
5853

5954
- name: Get safe branch and export to env

.github/workflows/update-data.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ build:
4848

4949
preview: RELEASES_DIR = $(VPS_PREVIEW_PATH)/$(SAFE_BRANCH)/releases
5050
preview: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)
51+
preview: build
5152
preview:
5253
@echo "Preview site URL: $(PREVIEW_SITE_URL)"
5354
echo $(TARGET)
@@ -61,17 +62,18 @@ preview:
6162
$(REMOTE_CMD) "bash -c '\
6263
cd $(RELEASES_DIR) && \
6364
echo \"[INFO] Cleaning:\" && \
64-
ls -1dt */ \
65-
| sed \"s:/*\\\$$::\" \
66-
| grep -v ^current\\\$$ \
67-
| grep -v ^$(TIMESTAMP)\\\$$ \
68-
| tail -n +2 \
65+
ls -1 */ \
66+
| sed \"s:/*\\\$$::\" \
67+
| grep \"^2025\" \
68+
| sort -r \
69+
| tail -n +4 \
6970
| xargs -r -I{} echo rm -rf \"{}\"'"
7071

7172

7273
ifeq ($(FORCE_DEPLOY), true)
7374
deploy: RELEASES_DIR = $(VPS_PROD_PATH)/releases
7475
deploy: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)
76+
deploy: build
7577
deploy:
7678
@echo "\n\n**** Deploying branch '$(BRANCH)' (safe: $(SAFE_BRANCH)) to $(TARGET)...\n\n"
7779
$(REMOTE_CMD) "mkdir -p $(TARGET)"

src/data/links.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@
198198
{
199199
"name": "Jobs",
200200
"path": "/jobs"
201+
},
202+
{
203+
"name": "Discord",
204+
"path": "https://discord.com/invite/BhTN2zJPMh"
201205
}
202206
]
203207
},

src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ footer {
8989

9090
@media screen and (width>1200px){
9191
main {
92-
margin-bottom:800px;
92+
margin-bottom:90vh;
9393
}
9494
footer {
9595
position: fixed;
File renamed without changes.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import { getCollection, getEntry } from "astro:content";
2+
import type { APIRoute } from "astro";
3+
4+
export const GET: APIRoute = async () => {
5+
const limit = Infinity;
6+
const sponsors = await getCollection("sponsors");
7+
const exclude = ["startup"];
8+
const records: any[] = [];
9+
10+
const charLimits: Record<string, number> = {
11+
instagram: 2200,
12+
x: 280,
13+
linkedin: 3000,
14+
bsky: 300,
15+
fosstodon: 500,
16+
};
17+
18+
const tiers = [
19+
"Keystone",
20+
"Diamond",
21+
"Platinum",
22+
"Platinum X",
23+
"Gold",
24+
"Silver",
25+
"Bronze",
26+
"Patron",
27+
] as const;
28+
29+
const commercialMessages = [
30+
"🎉✨ We are pleased to welcome SPONSOR_NAME as a sponsor for EuroPython 2025! Your support is making a huge difference. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
31+
"🚀✨ We are delighted to welcome SPONSOR_NAME as a sponsor for EuroPython 2025! Your support helps make this event extraordinary. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
32+
"🎉✨ A big thank you to SPONSOR_NAME for joining us as a sponsor for EuroPython 2025! Your support is making a huge impact. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
33+
"🚀✨ Big shoutout and heartfelt thanks to SPONSOR_NAME for sponsoring EuroPython 2025! Your support is crucial in bringing the European Python 🐍 community closer together. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
34+
"🎉✨ Thank you to SPONSOR_NAME for sponsoring EuroPython 2025! Your support is making a huge difference. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
35+
"🚀✨ A huge thank you to SPONSOR_NAME for sponsoring EuroPython 2025! Your support helps make this event extraordinary. 🙌SPONSOR_HANDLE SPONSOR_URL",
36+
];
37+
38+
const communityMessages = [
39+
"🎉✨ A warm thank you to SPONSOR_NAME for supporting EuroPython 2025! We're proud to be a space where communities come together, and we value the opportunity to collaborate with other communities and open-source projects. 🙌 SUPPORTER_HANDLE SUPPORTER_URL",
40+
];
41+
42+
const getRandomMessage = (messages: any) => {
43+
return messages[Math.floor(Math.random() * messages.length)];
44+
};
45+
46+
const isCommercialTier = (tier: any) => {
47+
return tiers.includes(tier);
48+
};
49+
50+
const message_template = {
51+
linkedin: ({ name, handle, url, tier }) => {
52+
const isCommercial = isCommercialTier(tier);
53+
const messages = isCommercial ? commercialMessages : communityMessages;
54+
const template = getRandomMessage(messages);
55+
56+
return template
57+
.replace(/SPONSOR_NAME/g, name)
58+
.replace(/SPONSOR_HANDLE/g, handle)
59+
.replace(/SPONSOR_URL/g, url)
60+
.replace(/SUPPORTER_HANDLE/g, handle)
61+
.replace(/SUPPORTER_URL/g, url);
62+
},
63+
};
64+
65+
const trimToLimit = (text: string, limit: number) =>
66+
text.length <= limit ? text : text.slice(0, limit - 1) + "…";
67+
68+
for (const sponsor of sponsors) {
69+
if (records.length >= limit) break;
70+
if (exclude.includes(sponsor.id)) continue;
71+
72+
const { name, url, tier, socials } = sponsor.data;
73+
74+
const sponsorImage = `https://ep2025.europython.eu/media/sponsors/social-${sponsor.id}.png`;
75+
76+
// Extract handles for each platform
77+
const handles = {
78+
linkedin: socials?.linkedin,
79+
};
80+
81+
// Generate appropriate messages for each platform
82+
const generateMessage = (platform: keyof typeof message_template) => {
83+
const templateFn = message_template[platform];
84+
const handle = handles[platform as keyof typeof handles] || "";
85+
86+
const full = templateFn({
87+
name,
88+
handle,
89+
url,
90+
tier,
91+
});
92+
93+
const limit = charLimits[platform];
94+
return trimToLimit(full, limit);
95+
};
96+
97+
const record = {
98+
name,
99+
image: sponsorImage,
100+
handles: handles,
101+
channel: {
102+
linkedin: generateMessage("linkedin"),
103+
},
104+
};
105+
106+
records.push(record);
107+
}
108+
109+
return new Response(JSON.stringify(records, null, 2), {
110+
status: 200,
111+
headers: {
112+
"Content-Type": "application/json",
113+
},
114+
});
115+
};

0 commit comments

Comments
 (0)