openmm / openmm-cookbook

The OpenMM Cookbook and Tutorials
39 stars 10 forks source link

fix gh-pages old builds and remove symlink #35

Closed sef43 closed 11 months ago

sef43 commented 11 months ago

Summary: The gh-pages branch has got messed up and This PR fixes it.

Background: Each time a release is made the current version is saved in the gh-pages branch e.g.: https://github.com/openmm/openmm-cookbook/tree/gh-pages/refs/tags/v0.1

This can then be viewed: https://openmm.github.io/openmm-cookbook/refs/tags/v0.1/index.html

Problem: However these saved older versions have been overwritten by the newer versions in the gh-actions automated build+deploy process. e.g. look at this commit: https://github.com/openmm/openmm-cookbook/commit/50915603e7a3fc6b19e0af0108e6d5433f2dafdb It has made changes in the refs/tags/v0.1 folder. It should not have.

Cause: The cause seems to be that latest is a symlink. I don't think symlinks work properly with the gh-pages workflow. When it checkouts the gh-pages branch to update it the symlink makes it copy files and update them in a way I dont fully understand. Infact the symlink should not really be there. The workflow that deploys a release and creates latest has a follow-symlinks=True option. This should actually copy the files:

        if: success()
        uses: crazy-max/ghaction-github-pages@v2
        with:
          target_branch: gh-pages
          build_dir: deploy
          jekyll: false
          commit_message: "Deploy to GH Pages"
          keep_history: true
          follow_symlinks: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

from https://github.com/marketplace/actions/github-pages#inputs: "If enabled, the content of symbolic links will be copied" Once the original symlink is removed it will correctly copy the latest tag to latest

Solution: I have manually removed the symlink and made latest a full copy. I have also manually rebuilt v0.1 and v0.2 from the correct tag.

Correct webpages made by this PR can be seen here: https://sef43.github.io/openmm-cookbook/refs/tags/v0.1/index.html https://sef43.github.io/openmm-cookbook/refs/tags/v0.2/index.html https://sef43.github.io/openmm-cookbook/refs/tags/v0.3/index.html https://sef43.github.io/openmm-cookbook/latest/index.html

When new releases are made the gh-actions will now work correctly and just make a new tag and make latest a new copy of the most recent tag. I tested this in a personal fork of the cookbook.

peastman commented 11 months ago

Thanks for catching and fixing this!