3636 - name : Build Package
3737 run : python3 -m build
3838
39- - name : Read version string
40- id : run_version
41- run : |
42- PYPI_VERSION=$(python setup.py --version)
43- [[ ${PYPI_VERSION} =~ ^[0-9]+\.[0-9]+\.[0-9]+.* ]] || {
44- echo "ERROR: unexpected version string '${PYPI_VERSION}'" >&2
45- exit 1
46- }
47- echo ::set-output name=pypi_version::${PYPI_VERSION}
48-
4939 - name : Publish Test Package
5040 uses : pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
5141 with :
5949 name : netfoundry-pypi-${{ github.run_id }}
6050 path : dist/netfoundry-*.tar.gz
6151
52+ - name : Read version string
53+ id : read_version
54+ run : |
55+ PYPI_VERSION=$(python setup.py --version)
56+ [[ ${PYPI_VERSION} =~ ^[0-9]+\.[0-9]+\.[0-9]+.* ]] || {
57+ echo "ERROR: unexpected version string '${PYPI_VERSION}'" >&2
58+ exit 1
59+ }
60+ echo ::set-output name=pypi_version::${PYPI_VERSION}
61+
62+ - name : Append 'latest' tag if release published
63+ env :
64+ GITHUB_ACTION : ${{ github.event.action }}
65+ PYPI_VERSION : ${{ steps.read_version.outputs.pypi_version }}
66+ id : compose_tags
67+ run : |
68+ CONTAINER_TAGS="netfoundry/python:${PYPI_VERSION}"
69+ if [[ ${GITHUB_ACTION} == "published" ]]; then
70+ CONTAINER_TAGS+=",netfoundry/python:latest"
71+ fi
72+ echo ::set-output name=container_tags::${CONTAINER_TAGS}
73+
6274 - name : Publish Release Package
63- if : github.event.action == " published"
75+ if : github.event.action == ' published'
6476 uses : pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
6577 with :
6678 user : __token__
88100 builder : ${{ steps.buildx.outputs.name }}
89101 platforms : linux/amd64,linux/arm/v7,linux/arm64
90102 push : true
91- tags : netfoundry/python: ${{ steps.run_version .outputs.pypi_version }}
103+ tags : ${{ steps.compose_tags .outputs.container_tags }}
0 commit comments