Skip to content

Commit 161d386

Browse files
committed
fix variables
1 parent e75db7d commit 161d386

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.github/workflows/preview.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
BRANCH_NAME=$(make safe_branch)
2828
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
2929
30+
- name: ssh keyscan
31+
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts
32+
3033
- name: Upload preview
3134
run: make preview
3235

Makefile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
VPS_USER ?= static_content_user
55
VPS_HOST ?= static.europython.eu
66
VPS_PROD_PATH ?= /home/static_content_user/content/europython_websites/ep2025
7-
VPS_PREVIEW_PATH ?= /home/static_content_user/content/previews/
7+
VPS_PREVIEW_PATH ?= /home/static_content_user/content/previews
88
REMOTE_CMD=ssh $(VPS_USER)@$(VPS_HOST)
99

1010
# Variables for build/deploy
@@ -47,22 +47,24 @@ build:
4747
# NOTE: also let's find a better way to do this :D
4848
find ./dist/_astro/ -iname '*.jpg' -delete
4949

50+
preview: RELEASES_DIR = $(VPS_PREVIEW_PATH)/$(SAFE_BRANCH)/releases
51+
preview: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)
52+
preview:
53+
echo $(TARGET)
54+
@echo "\n\n**** Deploying preview of a branch '$(BRANCH)' (safe: $(SAFE_BRANCH)) to $(TARGET)...\n\n"
55+
$(REMOTE_CMD) "mkdir -p $(TARGET)"
56+
rsync -avz --delete ./dist/ $(VPS_USER)@$(VPS_HOST):$(TARGET)/
57+
$(REMOTE_CMD) "cd $(RELEASES_DIR) && ln -snf $(TIMESTAMP) current"
58+
@echo "\n\n**** Preview complete.\n\n"
59+
60+
5061
ifeq ($(FORCE_DEPLOY), true)
62+
deploy: RELEASES_DIR = $(VPS_PROD_PATH)/$(SAFE_BRANCH)/releases
63+
deploy: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)
5164
deploy:
52-
RELEASES_DIR := $(VPS_PROD_PATH)/releases
53-
TARGET := $(RELEASES_DIR)/$(TIMESTAMP)
5465
@echo "\n\n**** Deploying branch '$(BRANCH)' (safe: $(SAFE_BRANCH)) to $(TARGET)...\n\n"
5566
$(REMOTE_CMD) "mkdir -p $(TARGET)"
5667
rsync -avz --delete ./dist/ $(VPS_USER)@$(VPS_HOST):$(TARGET)/
5768
$(REMOTE_CMD) "cd $(RELEASES_DIR) && ln -snf $(TIMESTAMP) current"
5869
@echo "\n\n**** Deployment complete.\n\n"
5970
endif
60-
61-
preview:
62-
RELEASES_DIR := $(VPS_PREVIEW_PATH)/$(SAFE_BRANCH)/releases
63-
TARGET := $(RELEASES_DIR)/$(TIMESTAMP)
64-
@echo "\n\n**** Deploying preview of a branch '$(BRANCH)' (safe: $(SAFE_BRANCH)) to $(TARGET)...\n\n"
65-
$(REMOTE_CMD) "mkdir -p $(TARGET)"
66-
rsync -avz --delete ./dist/ $(VPS_USER)@$(VPS_HOST):$(TARGET)/
67-
$(REMOTE_CMD) "cd $(RELEASES_DIR) && ln -snf $(TIMESTAMP) current"
68-
@echo "\n\n**** Preview complete.\n\n"

0 commit comments

Comments
 (0)