From db324ffb8e5181d8f67dc39d2231e596ff2b7990 Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Wed, 28 Feb 2024 11:22:08 +0100 Subject: [PATCH] [ci] update workflow files --- .github/workflows/distribution.yml | 49 ++++++++++++++++-------------- .github/workflows/main.yml | 7 +++-- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/distribution.yml b/.github/workflows/distribution.yml index 63e9c51e7..61aa724a4 100644 --- a/.github/workflows/distribution.yml +++ b/.github/workflows/distribution.yml @@ -2,42 +2,47 @@ name: distribute on: workflow_dispatch: + pull_request: push: - tags: "v*" + branches: + - main release: types: - published -jobs: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + FORCE_COLOR: 3 +jobs: dist: + name: Distribution build runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Build SDist and wheel - run: pipx run build - - - uses: actions/upload-artifact@v4 - with: - path: dist/* + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Check metadata - run: pipx run twine check dist/* + - uses: hynek/build-and-inspect-python-package@v2 publish: needs: [dist] + name: Publish to PyPI + environment: pypi + permissions: + id-token: write runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v4 - with: - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@v1.8.11 - with: - password: ${{ secrets.pypi_password }} + - uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'release' && github.event.action == 'published' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24b9bfbd8..76eb5c78b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,19 @@ name: pygama on: + workflow_dispatch: + pull_request: push: branches: - main - - 'releases/**' - pull_request: - release: + - "releases/**" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: + FORCE_COLOR: 3 TQDM_MININTERVAL: 100 jobs: