From 60630de4349f2013bf8dc9eac34be71ec8036b27 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 14 Aug 2024 21:49:03 +0000 Subject: [PATCH] ci: only run publish if pr title matches keywords --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aeea6ce..e6c75ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ permissions: pull-requests: write jobs: - publish: + release-please: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} name: "Bump version, create changelog and publish" @@ -35,10 +35,6 @@ jobs: with: target-branch: ${{ github.ref_name }} - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - if: ${{ steps.release.outputs }} id: versions run: | @@ -49,12 +45,36 @@ jobs: RELEASE_NAME="v$RELEASE_VERSION" RELEASE_CREATED='${{ steps.release.outputs.release_created }}' PRS_CREATED='${{ steps.release.outputs.prs_created }}' + PR_TITLE='${{ github.event.workflow_run.head_commit.message }}' echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" >> "${GITHUB_OUTPUT}" echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}" echo "RELEASE_CREATED=${RELEASE_CREATED}" >> "${GITHUB_OUTPUT}" - echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}" echo "RELEASE_NAME=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}" + echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}" + echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_OUTPUT}" + publish: + needs: release-please + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_commit.message, 'chore(master)') }} + name: "Bump version, create changelog and publish" + environment: + name: pypi + url: https://pypi.org/p/postgrest + steps: + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Set up Poetry + uses: abatilo/actions-poetry@v3 + with: + poetry-version: 1.8.3 + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install dependencies run: poetry install