Skip to content

Commit

Permalink
Squash doc into a single commit in gh-pages
Browse files Browse the repository at this point in the history
Avoid long list of unreadable and not very relevant commits on gh-pages
branch.
  • Loading branch information
nhuet authored and ducoffeM committed Jan 12, 2024
1 parent e0f2351 commit e2cd0aa
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
branch: gh-pages # The branch the action should deploy to.
folder: ${{ inputs.doc-path }} # The folder the action should deploy.
target-folder: /${{ inputs.doc-version }} # The folder the action should deploy to.
commit-message: publish documentation for ${{ inputs.doc-version }}
commit-message: publish documentation
single-commit: true

update-doc-versions:
# update doc versions index if the doc has been deployed
Expand All @@ -62,6 +63,8 @@ jobs:
with:
ref: gh-pages
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Generate versions.json
shell: python3 {0}
run: |
Expand All @@ -72,16 +75,15 @@ jobs:
versions = sorted((item.name for item in cwd.iterdir()
if item.is_dir() and not item.name.startswith('.')),
reverse=True)
target_dir = Path('gh-pages')
target_dir.mkdir(parents=True)
target_file = target_dir / 'versions.json'
target_file = Path('versions.json')
with target_file.open('w') as f:
json.dump(versions, f)
- name: Commit versions.json
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: gh-pages # The folder the action should deploy.
target-folder: / # The folder the action should deploy to.
commit-message: update versions.json
clean: false # do not remove other files (including whole doc versions)
shell: bash
run: |
# Commit versions.json and squash it with previous commit
git config user.name "Actions"
git config user.email "[email protected]"
git add versions.json
git commit --amend --no-edit
git push -f origin gh-pages

0 comments on commit e2cd0aa

Please sign in to comment.