deploy: napari/docs@45d18dcd4653f56e9fdaf438a5897882c44fc13a #265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Copy unversioned pages | |
on: | |
push: | |
branches: | |
- gh-pages | |
page_build: | |
workflow_dispatch: | |
jobs: | |
copy-pages: | |
name: Copy unversioned pages | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
steps: | |
- name: Clone artifacts repo | |
uses: actions/checkout@v4 | |
with: | |
ref: "gh-pages" | |
- name: Copy pages | |
run: | | |
ls -la | |
rm -rf ./stable/developers | |
cp -Rv ./dev/developers/ ./stable/ | |
rm -rf ./stable/naps | |
cp -Rv ./dev/naps/ ./stable/ | |
rm -rf ./stable/release | |
cp -Rv ./dev/release/ ./stable/ | |
rm -rf ./stable/roadmaps | |
cp -Rv ./dev/roadmaps/ ./stable/ | |
cp -v ./dev/index.html ./stable/ | |
find stable/developers/ -type f -exec sed -i 's+/_static+/../dev/_static+g' {} + | |
find stable/naps/ -type f -exec sed -i 's+/_static+/../dev/_static+g' {} + | |
find stable/release/ -type f -exec sed -i 's+/_static+/../dev/_static+g' {} + | |
find stable/roadmaps/ -type f -exec sed -i 's+/_static+/../dev/_static+g' {} + | |
sed -i 's+_static+../dev/_static+g' stable/index.html | |
STABLE=$(basename $(readlink -f ./stable)) | |
find stable/ -type f -exec sed -i "s+DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'dev';+DOCUMENTATION_OPTIONS.theme_switcher_version_match = '${STABLE}';+g" {} + | |
# closes napari/docs#545 ensures that docs copied from dev don't show the unstable version warning | |
find stable/ -type f -exec perl -0777 -i -pe "s/DOCUMENTATION_OPTIONS.show_version_warning_banner =\s*true;/DOCUMENTATION_OPTIONS.show_version_warning_banner = false;/sg" {} + | |
- name: Commit files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Copy unversioned files" --allow-empty | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |