Merge pull request #6 from uptick/py-313-builds #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Release | |
| 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 | |
| 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 |