Skip to content

Commit e3956e9

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

1 file changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/maturin.yaml

Lines changed: 52 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
@@ -18,9 +21,11 @@ jobs:
1821
target: [x86_64, aarch64]
1922
steps:
2023
- uses: actions/checkout@v3
24+
2125
- uses: actions/setup-python@v4
2226
with:
2327
python-version: "3.12"
28+
2429
- name: Build wheels
2530
uses: PyO3/maturin-action@v1
2631
with:
@@ -29,29 +34,34 @@ jobs:
2934
sccache: "true"
3035
args: --release --out dist -m Cargo.toml -i 3.12
3136
manylinux: auto
37+
3238
- name: Upload wheels
3339
uses: actions/upload-artifact@v4
3440
with:
3541
name: wheels-${{ matrix.target }}
3642
path: ./vrp-cli/dist
43+
3744
macos:
3845
runs-on: macos-latest
3946
strategy:
4047
matrix:
4148
target: [aarch64]
4249
steps:
4350
- uses: actions/checkout@v3
51+
4452
- uses: actions/setup-python@v4
4553
with:
4654
python-version: "3.12"
4755
architecture: "arm64"
56+
4857
- name: Build wheels
4958
uses: PyO3/maturin-action@v1
5059
with:
5160
working-directory: ./vrp-cli
5261
target: ${{ matrix.target }}
5362
args: --release --out dist --find-interpreter
5463
sccache: "true"
64+
5565
- name: Upload wheels
5666
uses: actions/upload-artifact@v4
5767
with:
@@ -70,9 +80,48 @@ jobs:
7080
with:
7181
path: .
7282
merge-multiple: true
73-
- name: List artifacts
74-
run: ls -lhs
83+
7584
- name: Upload to GitHub
85+
id: create-release
7686
uses: softprops/action-gh-release@v2
7787
with:
7888
files: ./*
89+
90+
- uses: actions/checkout@v3
91+
with:
92+
ref: gh-pages
93+
94+
- name: Generate PyPi index page
95+
id: generate_index
96+
shell: python
97+
env:
98+
ASSETS: ${{ steps.create-release.outputs.assets }}
99+
100+
run: |
101+
import json
102+
import os
103+
104+
# Load the assets data from the previous step
105+
assets = json.loads(os.environ['ASSETS'])
106+
107+
# Define the header for the index.md file
108+
index_content = "# vrp-cli\n\n"
109+
110+
# Iterate over the assets and format them into markdown links
111+
for asset in assets:
112+
name = asset['name']
113+
url = asset['browser_download_url']
114+
python_version = name.split('-')[2].split('cp3')[1]
115+
index_content += f'<a href="{url}" data-requires-python="==3.{python_version}">{name}</a><br />\n'
116+
117+
# Write the content to the index.md file
118+
with open('docs/vrp-cli/index.md', 'w') as f:
119+
f.write(index_content)
120+
121+
- name: Commit and push changes
122+
run: |
123+
git config --global user.name 'github-actions[bot]'
124+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
125+
git add docs/vrp-cli/index.md
126+
git commit -m 'docs: update PyPi index page'
127+
git push

0 commit comments

Comments
 (0)