Skip to content

Merge remote-tracking branches 'upstream/dependabot/github_actions/ac… #166

Merge remote-tracking branches 'upstream/dependabot/github_actions/ac…

Merge remote-tracking branches 'upstream/dependabot/github_actions/ac… #166

Workflow file for this run

name: Packaging
on:
pull_request:
branches-ignore:
- /doc\/.*/
push:
branches:
- dev
- maint/*
tags:
- '*'
defaults:
run:
shell: bash
jobs:
package:
# Build packages and upload
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
python-version: 3
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Check python version and install build
run: |
python --version
python -m pip install -U build twine
- name: Build fitlins
run: |
python -m build
- name: Check distributions
run: twine check dist/*
- name: Check for PyPI token
id: deployable
env:
TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi
if [ -n "$TEST_PYPI_API_TOKEN" ]; then echo ::set-output name=TEST_DEPLOY::true; fi
- name: Test PyPI upload
if: steps.deployable.outputs.TEST_DEPLOY
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Upload to PyPI (on tags)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && steps.deployable.outputs.DEPLOY
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}