Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): change site prefix to make cleaner work #6

Merged
merged 3 commits into from
Oct 20, 2024
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
7 changes: 2 additions & 5 deletions .github/workflows/pr_checker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ on:
# Environment variables
env:
BUILD_DIR: build/mkdocs/site
LANG: "fr_FR.UTF-8"
LC_ALL: "fr_FR.UTF-8"
LC_TIME: "fr_FR.UTF-8"
NETLIFY_SITE_NAME: geotribu-preprod
NETLIFY_SITE_PREFIX: preview-pullrequest-${{ github.event.pull_request.number }}
NETLIFY_SITE_PREFIX: geotribu-english-${{ github.event.pull_request.number }}
PR_NUMBER: ${{ github.event.pull_request.number }}

# If the workflow for a PR is triggered multiple times, previous existing runs will be canceled.
Expand Down Expand Up @@ -70,7 +67,7 @@ jobs:
MKDOCS_ENABLE_PLUGIN_RSS: true
MKDOCS_ENABLE_PLUGIN_SOCIAL: true
MKDOCS_ENABLE_PLUGIN_SOCIAL_CARDS: true
MKDOCS_SITE_NAME: "Geotribu PREVIEW - PR ${{ github.event.pull_request.number }}"
MKDOCS_SITE_NAME: "Geotribu in English PREVIEW - PR ${{ github.event.pull_request.number }}"
MKDOCS_SITE_COPYRIGHT: '<a href="https://www.netlify.com/"><img alt="Deploys by Netlify" src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" style="float: right;"></a>'
run: |
# store custom env vars that need resolution
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pr_cleaner_post_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ name: "🧹 PR Cleaner"
# only trigger on pull request closed events, that includes both merged and closed (dismissed) PRs
on:
pull_request_target:
types: [closed]
types:
- closed

# Environment variables
env:
BUILD_DIR: build/
NETLIFY_SITE_NAME: geotribu-preprod
NETLIFY_SITE_PREFIX: preview-pullrequest-${{ github.event.pull_request.number }}
NETLIFY_SITE_PREFIX: geotribu-english-${{ github.event.pull_request.number }}

jobs:
clean-preview:
Expand Down
29 changes: 29 additions & 0 deletions scripts/redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="fr">

<head>
<!-- <link rel="canonical" href="https://geotribu.fr/"> -->
<meta charset="utf-8">
<!-- <meta http-equiv="refresh" content="0; url='https://geotribu.fr/'" /> -->
<meta name="robots" content="noindex">
<title>Redirection Geotribu</title>
</head>

<body>
<p>Preview website closed. Thanks to visit <a href="https://blog.geotribu.net/">the main website</a>.</p>
<!-- Javascript -->
<script defer>
const url_base = window.location;
if (url_base.host.includes("preview-pullrequest-")) {
const new_url = "https://blog.geotribu.net" + url_base.pathname;
console.log("Redirected to:", new_url);
window.location.replace(new_url);
}
else {
let new_url = "https://blog.geotribu.net/";
window.location.replace(new_url);
}
</script>
</body>

</html>
Loading