diff --git a/.github/workflows/pypi-tag-deploy.yml b/.github/workflows/pypi-tag-deploy.yml index 63db11c8..dd8b04d8 100644 --- a/.github/workflows/pypi-tag-deploy.yml +++ b/.github/workflows/pypi-tag-deploy.yml @@ -1,4 +1,3 @@ -# Create a tag (on devel) or create release name: Deploy to PyPI on: @@ -8,33 +7,39 @@ on: - published jobs: - deploy: - + dist: + name: Distribution build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v1 with: python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build wheel twine setuptools setuptools_scm - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - uses: hynek/build-and-inspect-python-package@v1 - - name: Build package - run: | - python -m build --outdir dist/ - python -m twine check dist/* - python -m setuptools_scm --strip-dev + publish: + name: Publish + needs: [dist] + environment: + name: pypi + url: https://pypi.org/project/coffea-casa/ + permissions: + id-token: write + runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v3 + with: + name: Packages + path: dist - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - if: startsWith(github.ref, 'refs/tags') + - uses: pypa/gh-action-pypi-publish@release/v1 with: user: ${{ secrets.PYPI_USERNAME }} password: ${{ secrets.PYPI_PASSWORD }}