Skip to content

push tagged releases to Uptick's pypi repo automatically #30

push tagged releases to Uptick's pypi repo automatically

push tagged releases to Uptick's pypi repo automatically #30

Workflow file for this run

name: Publish Release

Check failure on line 1 in .github/workflows/maturin.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/maturin.yaml

Invalid workflow file

(Line: 91, Col: 9): Unexpected value 'secrets'
on:
workflow_dispatch:
push:
release:
types:
- released
- prereleased
permissions:
contents: write
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: "3.12"
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: "3.13"
- name: Build wheels
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # ratchet:PyO3/maturin-action@v1
with:
working-directory: ./vrp-cli
target: ${{ matrix.target }}
sccache: "true"
args: --release --out dist -m Cargo.toml -i 3.12 -i 3.13
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: wheels-${{ matrix.target }}
path: ./vrp-cli/dist
macos:
runs-on: macos-latest
strategy:
matrix:
target: [aarch64]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: "3.12"
architecture: "arm64"
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: "3.13"
architecture: "arm64"
- name: Build wheels
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # ratchet:PyO3/maturin-action@v1
with:
working-directory: ./vrp-cli
target: ${{ matrix.target }}
args: --release --out dist -m Cargo.toml -i 3.12 -i 3.13
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: ./vrp-cli/dist
pypi-publish:
name: Publish artifacts to Uptick's Pypi repo
if: startswith(github.ref, 'ref/tags/')
permissions:
contents: write
needs: [linux, macos]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: uptick/actions/.github/workflows/ci.yaml@main # ratchet:exclude
secrets: inherit
with:
pypi-dist: dist
uv: true
python: true
s3pypi-publish: true
gh-publish:
name: Publish artifacts to GH
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
needs: [linux, macos]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
path: .
merge-multiple: true
- name: Upload to GitHub
id: create-release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # ratchet:softprops/action-gh-release@v2
with:
files: ./*
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
ref: gh-pages
- name: Generate PyPi index page
id: generate_index
shell: python
env:
ASSETS: ${{ steps.create-release.outputs.assets }}
run: |
import json
import os
# Load the assets data from the previous step
assets = json.loads(os.environ['ASSETS'])
# Define the header for the index.md file
index_content = "# vrp-cli\n\n"
# Iterate over the assets and format them into markdown links
for asset in assets:
name = asset['name']
url = asset['browser_download_url']
python_version = name.split('-')[2].split('cp3')[1]
index_content += f'<a href="{url}" data-requires-python="==3.{python_version}">{name}</a><br />\n'
# Write the content to the index.md file
with open('docs/vrp-cli/index.md', 'w') as f:
f.write(index_content)
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/vrp-cli/index.md
git commit -m 'docs: update PyPi index page'
git push