Skip to content

Commit 8d35ec0

Browse files
authored
ci: add release please to the workflow (#890)
1 parent d95d253 commit 8d35ec0

File tree

10 files changed

+73
-313
lines changed

10 files changed

+73
-313
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,71 @@ jobs:
3939

4040
- name: Upload Coverage
4141
uses: codecov/codecov-action@v4
42-
publish:
42+
release-please:
4343
needs: test
44-
if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
4544
runs-on: ubuntu-latest
46-
name: "Bump version, create changelog and publish"
45+
name: "Bump version and create changelog"
46+
permissions:
47+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
48+
contents: write # needed for github actions bot to write to repo
49+
pull-requests: write
50+
steps:
51+
- uses: googleapis/release-please-action@v4
52+
id: release
53+
with:
54+
target-branch: ${{ github.ref_name }}
55+
56+
- if: ${{ steps.release.outputs }}
57+
id: versions
58+
run: |
59+
set -ex
60+
61+
MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
62+
RELEASE_VERSION="$MAIN_RELEASE_VERSION"
63+
RELEASE_NAME="v$RELEASE_VERSION"
64+
RELEASE_CREATED='${{ steps.release.outputs.release_created }}'
65+
PRS_CREATED='${{ steps.release.outputs.prs_created }}'
66+
PR_TITLE='${{ github.event.head_commit.message }}'
67+
68+
echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
69+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
70+
echo "RELEASE_CREATED=${RELEASE_CREATED}" >> "${GITHUB_OUTPUT}"
71+
echo "RELEASE_NAME=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}"
72+
echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}"
73+
echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_OUTPUT}"
74+
publish:
75+
needs: release-please
76+
if: ${{ startsWith(github.event.head_commit.message, 'chore(main)') && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
77+
runs-on: ubuntu-latest
78+
name: "Publish to PyPi"
4779
environment:
4880
name: pypi
4981
url: https://pypi.org/p/supabase
5082
permissions:
5183
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
5284
contents: write # needed for github actions bot to write to repo
5385
steps:
86+
- name: Set up Python 3.11
87+
uses: actions/setup-python@v5
88+
with:
89+
python-version: 3.11
90+
5491
- name: Clone Repository
5592
uses: actions/checkout@v4
5693
with:
5794
ref: ${{ github.ref }}
5895
fetch-depth: 0
59-
token: ${{ secrets.SILENTWORKS_PAT }}
60-
- name: Python Semantic Release
61-
id: release
62-
uses: python-semantic-release/[email protected]
96+
97+
- name: Set up Poetry
98+
uses: abatilo/actions-poetry@v3
6399
with:
64-
github_token: ${{ secrets.GITHUB_TOKEN }}
100+
poetry-version: 1.8.3
101+
102+
- name: Install dependencies
103+
run: poetry install
104+
105+
- name: Build package dist directory
106+
run: poetry build
65107

66108
- name: Publish package distributions to PyPI
67109
uses: pypa/gh-action-pypi-publish@release/v1
68-
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
69-
# See https://github.com/actions/runner/issues/1173
70-
if: steps.release.outputs.released == 'true'
71-
72-
- name: Publish package distributions to GitHub Releases
73-
uses: python-semantic-release/upload-to-gh-release@main
74-
if: steps.release.outputs.released == 'true'
75-
with:
76-
github_token: ${{ secrets.GITHUB_TOKEN }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "2.6.0"
3+
}

0 commit comments

Comments
 (0)