Skip to content

Commit

Permalink
Create pypi.yml
Browse files Browse the repository at this point in the history
Add workflow for building and inspecting python packages, uploading to TesPyPI, and (commented out for now) to real PyPI on releases
  • Loading branch information
jmaces authored Apr 25, 2024
1 parent 11e41f5 commit 2823483
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and maybe upload package to TestPyPI / PyPI

on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]
release:
types: [published]
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
build:
name: build and verify package
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: run build and verify
uses: hynek/build-and-inspect-python-package@v2

release-test-pypi:
name: publish dev versions to test.pypi.org
runs-on: ubuntu-latest
if: github.repository_owner == "dida-do" && github.event_name == "push" && github.ref == "refs/heads/main"
environment:
name: testpypi
url: https://test.pypi.org/p/eurocropsml
needs: build
steps:
- name: load the build artifacts
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: upload to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy

# release-pypi:
# name: publish released versions to pypi.org
# runs-on: ubuntu-latest
# if: github.repository_owner == "dida-do" && github.event.action == "published"
# environment:
# name: pypi
# url: https://pypi.org/p/eurocropsml
# needs: build
# steps:
# - name: load the build artifacts
# uses: actions/download-artifact@v4
# with:
# name: Packages
# path: dist
# - name: upload to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 2823483

Please sign in to comment.