diff --git a/.github/workflows/dev-release-testpypi.yml b/.github/workflows/dev-release-testpypi.yml new file mode 100644 index 0000000..02e5a17 --- /dev/null +++ b/.github/workflows/dev-release-testpypi.yml @@ -0,0 +1,86 @@ +name: Dev Release to TestPyPI + +on: + push: + branches: [dev] + workflow_dispatch: + +concurrency: + group: dev-release-testpypi + cancel-in-progress: false + +jobs: + dev-release-testpypi: + name: Create dev release and publish to TestPyPI + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/epics/ + + permissions: + contents: write + id-token: write + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Read package version + id: version + run: | + VERSION=$(python - <<'PY' + import tomllib + with open("pyproject.toml", "rb") as f: + data = tomllib.load(f) + print(data["project"]["version"]) + PY + ) + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" + + - name: Check if release already exists + id: release_exists + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.version.outputs.tag }} + run: | + if gh release view "$TAG" >/dev/null 2>&1; then + echo "exists=true" >> "$GITHUB_OUTPUT" + echo "Release $TAG already exists. Skipping publish." + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create GitHub prerelease + if: steps.release_exists.outputs.exists == 'false' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.version.outputs.tag }} + VERSION: ${{ steps.version.outputs.version }} + run: | + gh release create "$TAG" \ + --target "$GITHUB_SHA" \ + --prerelease \ + --title "$TAG" \ + --notes "Automated dev release for version $VERSION from dev branch." + + - name: Install build dependencies + if: steps.release_exists.outputs.exists == 'false' + run: python -m pip install --upgrade build + + - name: Build wheel and source distribution + if: steps.release_exists.outputs.exists == 'false' + run: python -m build + + - name: Publish to TestPyPI + if: steps.release_exists.outputs.exists == 'false' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/README.md b/README.md index 5acfaf9..0e4ddda 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PyEPICS -DOI +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18648203.svg)](https://doi.org/10.5281/zenodo.18648203) [![CI](https://github.com/melekderman/PyEPICS/actions/workflows/test.yml/badge.svg)](https://github.com/melekderman/PyEPICS/actions/workflows/test.yml) [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/) [![License: BSD-3](https://img.shields.io/badge/license-BSD--3--Clause-green.svg)](LICENSE) diff --git a/pyproject.toml b/pyproject.toml index 4b18139..87eddbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "epics" -version = "1.0.0" +version = "1.0.1.dev1" description = "Python library for reading and converting EPICS (Electron Photon Interaction Cross Sections) nuclear data" readme = "README.md" license = {text = "BSD-3-Clause"}