Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy to static server

on:
push:
branches:
- ep2024
schedule:
- cron: "*/10 * * * *" # every 10 minutes
workflow_dispatch:

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Setup uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies from uv.lock
run: make deps/install

- name: Download data
run: uv run make download > /dev/null 2>&1
env:
PRETALX_TOKEN: ${{ secrets.PRETALX_TOKEN }}

- name: Transform data
run: uv run make transform > /dev/null 2>&1

- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Adjust known_hosts
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts

- name: Deploy
run: uv run make deploy FORCE_DEPLOY=true
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Variables for the project
# =========================
CONFERENCE ?= ep2024
DATA_DIR ?= ./data/public/$(CONFERENCE)/

# Variables for remote host
# =========================
VPS_USER ?= static_content_user
VPS_HOST ?= static.europython.eu
VPS_PATH ?= /home/$(VPS_USER)/content/programapi/$(CONFERENCE)/releases
REMOTE_CMD=ssh $(VPS_USER)@$(VPS_HOST)

# Variables for deploy
# ==========================
TIMESTAMP ?= $(shell date +%Y%m%d%H%M%S)
FORCE_DEPLOY ?= false

dev:
uv sync --dev

Expand All @@ -21,6 +38,16 @@ endif

all: download transform

ifeq ($(FORCE_DEPLOY), true)
deploy: TARGET = $(VPS_PATH)/$(TIMESTAMP)
deploy:
@echo "\n\n**** Deploying branch '$(CONFERENCE)' to $(TARGET)...\n\n"
$(REMOTE_CMD) "mkdir -p $(TARGET)"
rsync -avz --delete $(DATA_DIR) $(VPS_USER)@$(VPS_HOST):$(TARGET)
$(REMOTE_CMD) "cd $(VPS_PATH) && ln -snf $(TIMESTAMP) current"
@echo "\n\n**** Deployment complete.\n\n"
endif

test:
uv run pytest

Expand Down
1 change: 0 additions & 1 deletion deploy/.python-version

This file was deleted.

11 changes: 0 additions & 11 deletions deploy/Makefile

This file was deleted.

28 changes: 0 additions & 28 deletions deploy/docker-compose.yml.j2

This file was deleted.

1 change: 0 additions & 1 deletion deploy/env.example

This file was deleted.

2 changes: 0 additions & 2 deletions deploy/hosts.ini

This file was deleted.

80 changes: 0 additions & 80 deletions deploy/init-letsencrypt.sh.j2

This file was deleted.

82 changes: 0 additions & 82 deletions deploy/nginx.conf.j2

This file was deleted.

Loading