Skip to content

Commit

Permalink
fix(ci): change site prefix to make cleaner work (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts authored Oct 20, 2024
2 parents 2303838 + ecc11bd commit beb0a10
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
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>

0 comments on commit beb0a10

Please sign in to comment.