Repository navigation
52 lines (48 loc) 路 1.79 KB
/
Copy pathpublish.yml
File metadata and controls
52 lines (48 loc) 路 1.79 KB
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
name: "馃摝 Publish (PyPI + docs)"
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.3.0)'
required: true
jobs:
check-pypi:
name: "馃攳 Check PyPI for existing package"
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
version: ${{ steps.check.outputs.version }}
steps:
- id: check
run: |
PACKAGE=$(echo "${{ github.repository }}" | cut -d/ -f2 | tr '-' '_')
VERSION=${{ inputs.version || github.ref_name }}
echo "version=$VERSION" >> $GITHUB_OUTPUT
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/$PACKAGE/$VERSION/json")
if [ "$STATUS" = "200" ]; then
echo "Package $PACKAGE $VERSION already exists on PyPI, skipping upload"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Package $PACKAGE $VERSION not found on PyPI, proceeding with upload"
echo "exists=false" >> $GITHUB_OUTPUT
fi
publish-pypi:
name: "馃摝 Build and upload to PyPI"
needs: check-pypi
if: needs.check-pypi.outputs.exists == 'false'
uses: clamsproject/.github/.github/workflows/sdk-publish-pyproj.yml@main
secrets: inherit
publish-docs:
name: "馃摉 Build and publish docs"
needs: [check-pypi, publish-pypi]
if: always() && needs.check-pypi.result == 'success' && needs.publish-pypi.result != 'failure'
uses: clamsproject/clamsproject.github.io/.github/workflows/sdk-docs.yml@main
with:
source_repo: clamsproject/mmif-python
source_ref: ${{ needs.check-pypi.outputs.version }}
project_name: mmif-python
version: ${{ needs.check-pypi.outputs.version }}
secrets: inherit