From f7f4745c0d7aa98f0f36a8f0fc20de9b7e676360 Mon Sep 17 00:00:00 2001 From: Luis Barroso-Luque Date: Wed, 13 Sep 2023 10:54:26 -0700 Subject: [PATCH] DEV: add release workflow --- .github/workflows/build.yml | 26 +------------------- .github/workflows/docs.yml | 2 +- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 2 ++ 4 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 823345b..a165e45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,6 @@ name: build -# Use this workflow to manually trigger a build for testing purposes. -# Download it from artifacts to test installation, or upload directly to PyPI. -on: - workflow_dispatch: - inputs: - release-pypi: - required: true - type: boolean +on: [workflow_dispatch, workflow_call] jobs: @@ -26,20 +19,3 @@ jobs: - uses: actions/upload-artifact@v3 with: path: dist/*.tar.gz - - release-pypi: - needs: [build_sdist] - runs-on: ubuntu-latest - if: github.event.inputs.release-pypi == 'true' - - steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@release/v1 - with: - verbose: true - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f1a388a..cbdeeba 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,6 +1,6 @@ name: build-documentation -on: workflow_dispatch +on: [workflow_dispatch, workflow_call] jobs: docs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7e9d445 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + release: + types: [published] + inputs: + release-pypi: + required: true + type: boolean + default: true + workflow_dispatch: + inputs: + release-pypi: + required: true + type: boolean + description: "if true a release is made on PyPI" + +jobs: + test: + uses: sparselm/sparselm/.github/workflows/test.yml@main + + build: + needs: test + uses: sparselm/sparselm/.github/workflows/build.yml@main + + release-docs: + needs: test + uses: sparselm/sparselm/.github/workflows/docs.yml@main + + release-pypi: + needs: [build, docs] + runs-on: ubuntu-latest + if: github.event.inputs.release-pypi == 'true' + + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cff02a9..30c6cd3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,8 @@ on: branches: - main + workflow_call: + jobs: test: runs-on: ubuntu-20.04