diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c30055f..90f38fc 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,14 +1,23 @@ name: Publish website -on: +# The site is published by the cartiflette repository (docs.yml), at +# https://inseefrlab.github.io/cartiflette/, with the client of that +# repository. This repository: +# - on a pull request, renders the site to check it; +# - on main, publishes only a redirect to that address on its own GitHub +# Pages (old links keep working, see redirect/index.html), then asks the +# cartiflette repository to republish the site. + +on: push: branches: - main - - master + pull_request: workflow_dispatch: jobs: - publish: + check: + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - name: Checkout @@ -32,15 +41,33 @@ jobs: # _brand.yml (identité visuelle) demande Quarto 1.6 ou plus version: 1.10.18 - - name: Render FR version + - name: Render the site uses: quarto-dev/quarto-actions/render@v2 env: QUARTO_PROFILE: complete - - name: Publish to GitHub Pages (and render) - uses: quarto-dev/quarto-actions/publish@v2 + + publish: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Every path of the former site falls back on 404.html: same redirect + - name: Prepare the redirect + run: cp redirect/index.html redirect/404.html + + - name: Publish the redirect to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 with: - render: false - target: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: ./redirect + # Only the redirect: the pages of the former site are removed + force_orphan: true + commit_message: "Redirection vers https://inseefrlab.github.io/cartiflette/" - name: Rebuild the site published by cartiflette env: diff --git a/README.md b/README.md index 7f227bc..c9903a2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,15 @@ uv pip install ../cartiflette/python-package/cartiflette ## Publication -`.github/workflows/publish.yaml` rend le site (profil `complete`) à chaque push sur -`main` et le publie sur GitHub Pages. Il demande ensuite au dépôt cartiflette de -republier le site complet, qui y ajoute la documentation technique sous `doc/` et -utilise le client de ce dépôt-là (`docs.yml`). +Le site est publié par le dépôt [cartiflette](https://github.com/InseeFrLab/cartiflette) +(`.github/workflows/docs.yml`), à l'adresse , +avec la documentation technique sous `doc/` et le client de ce dépôt-là. + +`.github/workflows/publish.yaml` : + +- sur une pull request, rend le site (profil `complete`) pour le vérifier ; +- à chaque push sur `main`, demande au dépôt cartiflette de republier le site, et + ne publie sur les GitHub Pages de ce dépôt qu'une redirection + (`redirect/index.html`, servie aussi comme `404.html`) : les anciennes adresses + `https://inseefrlab.github.io/cartiflette-website/...` renvoient vers la même page + du nouveau site. diff --git a/_quarto.yml b/_quarto.yml index b7bf87c..1b07472 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -9,7 +9,7 @@ lang: fr website: title: "cartiflette" description: "Les fonds de carte officiels français, en une ligne de code" - site-url: https://inseefrlab.github.io/cartiflette-website/ + site-url: https://inseefrlab.github.io/cartiflette/ favicon: images/logo.png page-navigation: true navbar: diff --git a/redirect/index.html b/redirect/index.html new file mode 100644 index 0000000..0af6fd9 --- /dev/null +++ b/redirect/index.html @@ -0,0 +1,25 @@ + + + + + cartiflette a déménagé + + + + + + +

+ Le site de cartiflette est maintenant à l'adresse + https://inseefrlab.github.io/cartiflette/. +

+ +