Skip to content

[v7r3] Fix: reintroducing Staging to Checking transition #7323

[v7r3] Fix: reintroducing Staging to Checking transition

[v7r3] Fix: reintroducing Staging to Checking transition #7323

Workflow file for this run

name: Deployment
on: [push, pull_request]
jobs:
deploy-pypi:
name: PyPI deployment
runs-on: "ubuntu-latest"
if: github.event_name != 'push' || github.repository == 'DIRACGrid/DIRAC'
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Installing dependencies
run: |
python -m pip install \
build \
diraccfg \
packaging \
python-dateutil \
pytz \
readme_renderer \
requests \
setuptools_scm \
six \
uritemplate
- name: Validate README for PyPI
run: |
python -m readme_renderer README.rst -o /tmp/README.html
- name: Check tag is for v7r2 or later
id: check-tag
# When v8 is released we can remove this check
run: |
if [[ "${{ github.event.ref }}" =~ ^refs/tags/v7r([2-9]|[0-9][0-9]+)(p[0-9]+)?(-pre[0-9]+)?$ ]]; then
echo "create-release=true" >> $GITHUB_OUTPUT
fi
- name: Make PEP-440 style release on GitHub
if: steps.check-tag.outputs.create-release == 'true'
run: |
set -e
OLD_STYLE=${GITHUB_REF##*/}
NEW_STYLE=$(python -c "import diraccfg; major, minor, patch, pre = diraccfg.parseVersion('${OLD_STYLE}'); print(f'{major}.{minor}.{patch}', f'a{pre}' if pre else '', sep='')")
echo "Converted ${OLD_STYLE} version to ${NEW_STYLE}"
.github/workflows/make_release.py \
--token="${{ secrets.GITHUB_TOKEN }}" \
--version="v${NEW_STYLE}" \
--rev="$(git rev-parse HEAD)"
git fetch --all --tags
# Need to do this after creating the PEP-440 style tag
- name: Build distributions
run: |
python -m build
- name: Publish package on PyPI
if: steps.check-tag.outputs.create-release == 'true'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}