Skip to content

Commit 89d6bbe

Browse files
committed
New deployment logic
1 parent 0e99bc0 commit 89d6bbe

14 files changed

+73
-344
lines changed

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Tests
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
tests:
7+
name: Run tests
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 10
10+
11+
steps:
12+
- name: Check out repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python 3
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.13'
19+
20+
- name: Setup uv
21+
uses: astral-sh/setup-uv@v5
22+
23+
- name: Install dependencies from uv.lock
24+
run: make deps/install
25+
26+
- name: Download data
27+
run: uv run make download > /dev/null
28+
env:
29+
PRETALX_TOKEN: ${{ secrets.PRETALX_TOKEN }}
30+
31+
- name: Transform data
32+
run: uv run make transform > /dev/null
33+
34+
- name: Setup SSH
35+
uses: webfactory/[email protected]
36+
with:
37+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
38+
39+
- name: Adjust known_hosts
40+
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts
41+
42+
- name: Deploy
43+
run: uv run make deploy FORCE_DEPLOY=true > /dev/null

Dockerfile

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

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Variables for the project
2+
# =========================
3+
CONFERENCE ?= ep2024
4+
DATA_DIR ?= ./data/public/$(CONFERENCE)/
5+
6+
# Variables for remote host
7+
# =========================
8+
VPS_USER ?= static_content_user
9+
VPS_HOST ?= static.europython.eu
10+
VPS_PATH ?= /home/$(VPS_USER)/content/programapi/$(CONFERENCE)/releases
11+
REMOTE_CMD=ssh $(VPS_USER)@$(VPS_HOST)
12+
13+
# Variables for deploy
14+
# ==========================
15+
TIMESTAMP ?= $(shell date +%Y%m%d%H%M%S)
16+
FORCE_DEPLOY ?= false
17+
118
dev:
219
uv sync --dev
320

@@ -21,6 +38,16 @@ endif
2138

2239
all: download transform
2340

41+
ifeq ($(FORCE_DEPLOY), true)
42+
deploy: TARGET = $(VPS_PATH)/$(TIMESTAMP)
43+
deploy:
44+
@echo "\n\n**** Deploying branch '$(CONFERENCE)' to $(TARGET)...\n\n"
45+
$(REMOTE_CMD) "mkdir -p $(TARGET)"
46+
rsync -avz --delete $(DATA_DIR) $(VPS_USER)@$(VPS_HOST):$(TARGET)
47+
$(REMOTE_CMD) "cd $(VPS_PATH) && ln -snf $(TIMESTAMP) current"
48+
@echo "\n\n**** Deployment complete.\n\n"
49+
endif
50+
2451
test:
2552
uv run pytest
2653

deploy/.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

deploy/Makefile

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

deploy/docker-compose.yml.j2

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

deploy/env.example

Lines changed: 0 additions & 1 deletion
This file was deleted.

deploy/hosts.ini

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

deploy/init-letsencrypt.sh.j2

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

deploy/nginx.conf.j2

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

0 commit comments

Comments
 (0)