forked from DIRACGrid/DIRAC
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (62 loc) · 2.19 KB
/
deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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 }}