Skip to content

Merge pull request #154 from XAITK/update-to-v0.8.3 #8

Merge pull request #154 from XAITK/update-to-v0.8.3

Merge pull request #154 from XAITK/update-to-v0.8.3 #8

Workflow file for this run

name: Publish
# Controls when the action will run.
on:
push:
tags:
# Only run on tags with official version tag release format (e.g. v1.0.1)
- "v[0-9].[0-9]+.[0-9]+"
# Allow use of this workflow as a reusable workflow.
# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
workflow_call:
secrets:
PYPI_TOKEN:
required: true
defaults:
run:
shell: bash
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
publish:
runs-on: ubuntu-latest
container: python:3.8
# This should only be run for tags on the "official" repository org.
if: github.repository_owner == 'XAITK'
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Cache local python environment artifacts for the current python version
# and poetry lockfile hash.
- uses: actions/cache@v3
id: env-cache
with:
# Confirmed that the `.local` directory doesn't exist until the
# `pip install --user` is invoked below, so we can be confident that
# only our python stuff is being captured in this cache (intentional).
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-3.8-${{ hashFiles('poetry.lock') }}
- name: Setup Environment
# Using non-relative path for correct behavior when used as a remote
# workflow.
uses: Kitware/SMQTK-Core/.github/actions/python-poetry-setup@master
# Ensure there is alignment with the tag reference and the reported
# version of the package
- name: Ensure synchronized pacakge and ref
run: |
PACKAGE_VERSION="v$(poetry version -s)"
if [[ "${{ github.ref_name }}" != "${PACKAGE_VERSION}" ]]
then
echo "ERROR: Git tag reference and package version are NOT synonymous."
echo " Package version: ${PACKAGE_VERSION}"
echo " Git ref name : ${{ github.ref_name }}"
exit 1
fi
- name: Publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN}}
run: |
if [[ -z "$POETRY_PYPI_TOKEN_PYPI" ]]
then
echo "ERROR: Input pypi token was blank. Did you forget to set the appropriate secret?"
exit 1
fi
echo "Publishing new tag: ${{ github.ref_name }}"
poetry publish --build