Skip to content

Commit

Permalink
Fix versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nhuet committed Jan 11, 2024
1 parent 38aa660 commit 20f7036
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: gh-pages
- uses: actions/setup-python@v4
- name: Generate versions.json
shell: bash
shell: python3 {0}
run: |
mkdir versions_folder
echo ["main", "0.1.19", "0.1.18", "0.1.12", "0.1.11"] > versions_folder/versions.json
import json
from pathlib import Path
cwd = Path.cwd()
versions = sorted((item.name for item in cwd.iterdir()
if item.is_dir() and not item.name.startswith('.')),
reverse=True)
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: versions_folder # The folder the action should deploy.
target-folder: / # The folder the action should deploy to.
commit-message: publish documentation
single-commit: true
clean: false
shell: bash
run: |
# Commit versions.json and squash it with previous commit
git config user.name "Actions"
git config user.email "actions@github.com"
git add versions.json
git commit --amend --no-edit
git push origin gh-pages

0 comments on commit 20f7036

Please sign in to comment.