From b0ff867dcc22a65bf292cb94795ae3131765e2c8 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Fri, 5 Apr 2024 10:59:00 +0200 Subject: [PATCH] .github: Merge release and PyPI steps. "on: release" only triggers for manual releases, not releases created by another workflow. Fixes https://github.com/pybricks/support/issues/1558 --- .github/workflows/release-to-pypi.yml | 15 --------------- .github/workflows/release.yml | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 .github/workflows/release-to-pypi.yml diff --git a/.github/workflows/release-to-pypi.yml b/.github/workflows/release-to-pypi.yml deleted file mode 100644 index 1187f06..0000000 --- a/.github/workflows/release-to-pypi.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Release to PyPI - -on: - release: - types: [published] - -jobs: - build_and_publish: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - run: pipx run poetry build - - run: pipx run poetry publish - env: - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5ae208..d5d3a2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,16 +3,23 @@ on: tags: - 'v3.*' -name: Create release +name: Create release on GitHub and PyPI permissions: contents: write jobs: - upload_release: - name: Upload Release Assets + create_release: + name: Create release on GitHub runs-on: ubuntu-22.04 steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - name: Get tag + run: echo "GITHUB_TAG=${GITHUB_REF#*refs/tags/}" >> $GITHUB_ENV - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -28,3 +35,11 @@ jobs: --title="${tag#v}" \ -F CHANGELOG.md \ $PRERELEASE_FLAG + build_and_publish: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - run: pipx run poetry build + - run: pipx run poetry publish + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}