@@ -131,10 +131,29 @@ jobs:
131131
132132 REPO_SOURCE_REF_TYPE="$SOURCE_REF_TYPE" \
133133 REPO_SOURCE_REF_NAME="$SOURCE_REF_NAME" \
134+ REPO_PUBLIC_BASE_URL="https://repo.keen-pbr.fyi" \
134135 make -C "$GITHUB_WORKSPACE/src" build-repository \
135136 REPO_DIR="$GITHUB_WORKSPACE/staged-repository" \
136137 REPO_TARGET_ROOT="$branch"
137138
139+ printf '%s\n' \
140+ '<!doctype html>' \
141+ '<html lang="en">' \
142+ '<head>' \
143+ ' <meta charset="utf-8">' \
144+ ' <meta http-equiv="refresh" content="0; url=https://repo.keen-pbr.fyi/repository/stable/">' \
145+ ' <link rel="canonical" href="https://repo.keen-pbr.fyi/repository/stable/">' \
146+ ' <title>keen-pbr repository</title>' \
147+ '</head>' \
148+ '<body>' \
149+ ' <p><a href="https://repo.keen-pbr.fyi/repository/stable/">Open the stable keen-pbr repository</a></p>' \
150+ '</body>' \
151+ '</html>' \
152+ > "$GITHUB_WORKSPACE/staged-repository/index.html"
153+ printf '%s\n' \
154+ 'RedirectMatch 302 ^/$ https://repo.keen-pbr.fyi/repository/stable/' \
155+ > "$GITHUB_WORKSPACE/staged-repository/.htaccess"
156+
138157 echo "branch=$branch" >> "$GITHUB_OUTPUT"
139158 echo "release-prefix=$release_prefix" >> "$GITHUB_OUTPUT"
140159 echo "link-name=$link_name" >> "$GITHUB_OUTPUT"
@@ -185,12 +204,13 @@ jobs:
185204 rsync_target="$ssh_target"
186205 fi
187206 target_root="${RSYNC_TARGET_ROOT%/}"
188- release_dir="$target_root/${RELEASE_PREFIX}_${BUILD_NUMBER}.release"
207+ repository_root="$target_root/repository"
208+ release_dir="$repository_root/${RELEASE_PREFIX}_${BUILD_NUMBER}.release"
189209 source_dir="$GITHUB_WORKSPACE/staged-repository/$BRANCH/"
190210 static_source="$GITHUB_WORKSPACE/staged-repository"
191211
192212 ssh "${ssh_options[@]}" "$ssh_target" \
193- "mkdir -p -- '$release_dir' '$target_root/assets' '$target_root/keys'"
213+ "mkdir -p -- '$release_dir' '$target_root/assets' '$target_root/keys' '$repository_root' "
194214 # The generated repository page references these shared paths from the
195215 # target root, so publish them before exposing this build.
196216 rsync -a --delete --delay-updates \
@@ -199,11 +219,17 @@ jobs:
199219 rsync -a --delete --delay-updates \
200220 -e "ssh -i $HOME/.ssh/id_rsync -p $RSYNC_PORT -o BatchMode=yes -o StrictHostKeyChecking=accept-new" \
201221 "$static_source/keys/" "$rsync_target:$target_root/keys/"
222+ rsync -a --delay-updates \
223+ -e "ssh -i $HOME/.ssh/id_rsync -p $RSYNC_PORT -o BatchMode=yes -o StrictHostKeyChecking=accept-new" \
224+ "$static_source/index.html" "$rsync_target:$target_root/index.html"
225+ rsync -a --delay-updates \
226+ -e "ssh -i $HOME/.ssh/id_rsync -p $RSYNC_PORT -o BatchMode=yes -o StrictHostKeyChecking=accept-new" \
227+ "$static_source/.htaccess" "$rsync_target:$target_root/.htaccess"
202228 rsync -a --delete --delay-updates \
203229 -e "ssh -i $HOME/.ssh/id_rsync -p $RSYNC_PORT -o BatchMode=yes -o StrictHostKeyChecking=accept-new" \
204230 "$source_dir" "$rsync_target:$release_dir/"
205231
206232 # This runs only after every rsync exits successfully. Renaming the
207233 # prepared temporary symlink atomically replaces the live link.
208234 ssh "${ssh_options[@]}" "$ssh_target" \
209- "rm -f -- '$target_root /.${LINK_NAME}.new' && ln -s -- '$release_dir' '$target_root /.${LINK_NAME}.new' && mv -Tf -- '$target_root /.${LINK_NAME}.new' '$target_root /$LINK_NAME'"
235+ "rm -f -- '$repository_root /.${LINK_NAME}.new' && ln -s -- '$release_dir' '$repository_root /.${LINK_NAME}.new' && mv -Tf -- '$repository_root /.${LINK_NAME}.new' '$repository_root /$LINK_NAME'"
0 commit comments