Skip to content

Commit ede7c1a

Browse files
authored
ci: add release please to the workflow (#183)
1 parent 562a1ed commit ede7c1a

File tree

7 files changed

+66
-665
lines changed

7 files changed

+66
-665
lines changed

.github/workflows/ci.yml

+50-17
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,71 @@ jobs:
3737

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

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

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.0.6"
3+
}

0 commit comments

Comments
 (0)