Skip to content

Commit 46cbf22

Browse files
committed
ci: auto-update pypi index
1 parent 98026ca commit 46cbf22

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

.github/workflows/maturin.yaml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
name: Publish to PyPI
1+
name: Publish Release
22

33
on:
44
workflow_dispatch:
5+
push:
6+
tags:
7+
- "*"
58
release:
69
types:
710
- released
@@ -70,9 +73,45 @@ jobs:
7073
with:
7174
path: .
7275
merge-multiple: true
73-
- name: List artifacts
74-
run: ls -lhs
76+
7577
- name: Upload to GitHub
78+
id: create-release
7679
uses: softprops/action-gh-release@v2
7780
with:
7881
files: ./*
82+
83+
- uses: actions/checkout@v3
84+
85+
- name: Generate PyPi index page
86+
id: generate_index
87+
shell: python
88+
env:
89+
ASSETS: ${{ steps.create-release.outputs.assets }}
90+
run: |
91+
import json
92+
import os
93+
94+
# Load the assets data from the previous step
95+
assets = json.loads(os.environ['ASSETS'])
96+
97+
# Define the header for the index.md file
98+
index_content = "# vrp-cli\n\n"
99+
100+
# Iterate over the assets and format them into markdown links
101+
for asset in assets:
102+
name = asset['name']
103+
url = asset['browser_download_url']
104+
python_version = name.split('-')[2].split('cp3')[1]
105+
index_content += f'<a href="{url}" data-requires-python="==3.{python_version}">{name}</a><br />\n'
106+
107+
# Write the content to the index.md file
108+
with open('docs/vrp-cli/index.md', 'w') as f:
109+
f.write(index_content)
110+
111+
- name: Commit and push changes
112+
run: |
113+
git config --global user.name 'github-actions[bot]'
114+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
115+
git add docs/vrp-cli/index.md
116+
git commit -m 'docs: update PyPi index page'
117+
git push

0 commit comments

Comments
 (0)