Skip to content

Commit 2986d4c

Browse files
nikoshellegeakman
andauthored
Add SITE_URL for preview. (#1132)
Fix #1100. --------- Co-authored-by: egeakman <[email protected]>
1 parent eb6a957 commit 2986d4c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.github/workflows/preview.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ jobs:
3232
- name: Install dependencies
3333
run: make install
3434

35+
- name: Get current branch name
36+
run: |
37+
BRANCH_NAME=$(make safe_branch BRANCH=$GITHUB_BRANCH_NAME)
38+
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
39+
3540
- name: Build the website
36-
run: make build PREVIEW=true
41+
run:
42+
make build PREVIEW=true
43+
SITE_URL="https://${BRANCH_NAME}.ep-preview.click"
3744

3845
- name: Set up SSH key
3946
uses: webfactory/[email protected]
4047
with:
4148
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
4249

43-
- name: Get current branch name
44-
run: |
45-
BRANCH_NAME=$(make safe_branch BRANCH=$GITHUB_BRANCH_NAME)
46-
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
47-
4850
- name: ssh keyscan
4951
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts
5052

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ build:
2020
commands:
2121
- npm install -g pnpm@latest-10
2222
- make install
23-
- make build PREVIEW=true
23+
- make build PREVIEW=true SITE_URL=$READTHEDOCS_CANONICAL_URL
2424
- mkdir -p $READTHEDOCS_OUTPUT/html
2525
- cd dist && cp -r * $READTHEDOCS_OUTPUT/html

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ VPS_HOST ?= static.europython.eu
66
VPS_PROD_PATH ?= /home/static_content_user/content/europython_websites/ep2025
77
VPS_PREVIEW_PATH ?= /home/static_content_user/content/previews
88
REMOTE_CMD=ssh $(VPS_USER)@$(VPS_HOST)
9+
PREVIEW_SITE_URL ?= "https://$(SAFE_BRANCH).ep-preview.click"
910

1011
# Variables for build/deploy
1112
# ==========================
@@ -47,13 +48,14 @@ build:
4748
preview: RELEASES_DIR = $(VPS_PREVIEW_PATH)/$(SAFE_BRANCH)/releases
4849
preview: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)
4950
preview:
50-
@echo "Preview site URL: $(SITE_URL)" # Output preview URL
51+
@echo "Preview site URL: $(PREVIEW_SITE_URL)"
5152
echo $(TARGET)
5253
@echo "\n\n**** Deploying preview of a branch '$(BRANCH)' (safe: $(SAFE_BRANCH)) to $(TARGET)...\n\n"
5354
$(REMOTE_CMD) "mkdir -p $(TARGET)"
5455
rsync -avz --delete ./dist/ $(VPS_USER)@$(VPS_HOST):$(TARGET)/
5556
$(REMOTE_CMD) "cd $(RELEASES_DIR) && ln -snf $(TIMESTAMP) current"
5657
@echo "\n\n**** Preview complete.\n\n"
58+
@echo "Open the preview site at: $(PREVIEW_SITE_URL)\n\n"
5759

5860

5961
ifeq ($(FORCE_DEPLOY), true)

0 commit comments

Comments
 (0)