Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deployment

on:
push:
tags:
- v1r[0-9]+
pull_request:

jobs:
deploy-pypi:
name: PyPI deployment
runs-on: "ubuntu-latest"
if: github.event_name != 'push' || github.repository == 'DIRACGrid/COMDIRAC'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: pip install build readme_renderer diraccfg
- name: Validate README for PyPI
run: python -m readme_renderer README.* -o /tmp/README.html
- name: Make PEP-440 style release on GitHub
id: PEP-440
if: github.event_name == 'push'
run: |
TAG_NAME=${GITHUB_REF##*/}
NEW_STYLE=$(python -c "import diraccfg; major, minor, patch, pre = diraccfg.parseVersion('${TAG_NAME}'); print(f'{major}.{minor}.{patch}', f'a{pre}' if pre else '', sep='')")
echo "Converted ${TAG_NAME} version to ${NEW_STYLE}"
echo ::set-output name=tag_name::"v$NEW_STYLE"
echo ::set-output name=target_commitish::"$(git rev-parse HEAD)"
- name: Publish ${{ steps.PEP-440.outputs.tag_name }} release to GitHub
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
target_commitish: ${{ steps.PEP-440.outputs.target_commitish }}
body_path: release.notes
tag_name: ${{ steps.PEP-440.outputs.tag_name }}
- name: Get ${{ steps.PEP-440.outputs.tag_name }} tag
if: github.event_name == 'push'
uses: actions/checkout@v2
with:
ref: ${{ steps.PEP-440.outputs.tag_name }}
- name: Build distributions
run: python -m build
- name: Publish package on PyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}