Upload msgpack-cxx from brew to PyPI #40
Workflow file for this run
This file contains 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
# SPDX-FileCopyrightText: 2022 Contributors to the Power Grid Model project <[email protected]> | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
name: Upload msgpack-cxx to PyPI | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
get-versions: | |
name: "Upload latest msgpack-cxx version to PyPI" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USER }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
architecture: x64 | |
- name: Install dependencies | |
run: pip install requests build | |
- name: Enable brew | |
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH | |
- name: Download msgpack-cxx | |
run: brew install msgpack-cxx | |
- name: Get latest version | |
id: version | |
run: echo "latest=$(brew list --version msgpack-cxx | sed -e 's/msgpack-cxx\s//')" >> $GITHUB_OUTPUT | |
- name: List version | |
run: echo "latest=${{ steps.version.outputs.latest }}" | |
- name: Get the msgpack-cxx contents | |
run: cp -r /home/linuxbrew/.linuxbrew/Cellar/msgpack-cxx/${{ steps.version.outputs.latest }}/* msgpack-cxx | |
- name: Download LICENSE_1_0.txt again because Brew does not package it | |
run: wget http://www.boost.org/LICENSE_1_0.txt -o msgpack-cxx/LICENSE_1_0.txt | |
- name: Set PyPI Version | |
run: echo "${{ steps.version.outputs.latest }}" >> msgpack-cxx/PYPI_VERSION | |
- name: Show contents | |
run: ls -ahl msgpack-cxx | |
- name: Build SDist | |
run: python -m build --sdist --outdir wheelhouse msgpack-cxx | |
- name: Keep version file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: version | |
path: msgpack-cxx/PYPI_VERSION | |
- name: Keep SDist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheelhouse | |
path: ./wheelhouse/*.tar.gz | |
- name: List assets | |
run: ls ./wheelhouse/ -al | |
- name: Upload wheels | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
pip install twine | |
echo "Publish to PyPI..." | |
twine upload --verbose wheelhouse/* |