install graphviz dep #2
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
name: publish | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
jobs: | |
build-n-publish-pypi: | |
name: Build and publish Python distribution 📦 to PyPI and TestPyPI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out src from Git | |
uses: actions/checkout@master | |
- name: Get history and tags for SCM versioning to work | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: >- | |
python -m | |
pip install | |
build | |
--user | |
- name: Build a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--outdir dist/ | |
- name: Publish distribution 📦 to Test PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
build-and-push-docker: | |
runs-on: ubuntu-latest | |
needs: build-n-publish-pypi | |
if: github.event_name != 'pull-request' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Get Docker metadata for cli tool | |
id: cli | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKER_USERNAME }}/ofcli | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Get Docker metadata for api tool | |
id: api | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKER_USERNAME }}/ofapi | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Build and push cli image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
target: ofcli | |
tags: ${{ steps.cli.outputs.tags }} | |
labels: ${{ steps.cli.outputs.labels }} | |
- name: Build and push api image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
target: ofapi | |
tags: ${{ steps.api.outputs.tags }} | |
labels: ${{ steps.api.outputs.labels }} |