Skip to content

Build and publish PyPI artifact #180

Build and publish PyPI artifact

Build and publish PyPI artifact #180

name: Build and publish PyPI artifact
on:
workflow_dispatch:
jobs:
build_and_publish_package:
name: Build and publish the PyPi package
runs-on: ubuntu-latest
concurrency: publishing
steps:
- name: Checkout main
uses: actions/checkout@v2
- name: Checkout submodules using a PAT
run: |
git config --file .gitmodules --get-regexp url | while read url; do
git config --file=.gitmodules $(echo "$url" | sed -E "s/[email protected]:|https:\/\/github.com\//https:\/\/${{ secrets.OPENDATADISCOVERY_BOT_PAT }}:${{ secrets.OPENDATADISCOVERY_BOT_PAT }}@github.com\//")
done
git submodule sync
git submodule update --init --recursive
git submodule foreach git pull origin main
git checkout .gitmodules
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Patch package version
run: poetry version patch
- name: Run Dockerfile to build and publish package into PyPI
run: |
docker build . -t ignored \
--build-arg PYPI_USERNAME=${{ secrets.PYPI_USERNAME }} \
--build-arg PYPI_PASSWORD=${{ secrets.PYPI_PASSWORD }}
- name: Update repository with up-to-date submodules and version
run: |
git config --global user.email "[email protected]"
git config --global user.name "OpenDataDiscovery Bot"
if [ -n "$(git status --porcelain)" ]
then
git add .
git commit -m "Update submodule branch ref and bump package version"
git push origin main
fi