@@ -39,87 +39,123 @@ jobs:
3939 run : |
4040 pip install pydantic==1.10.12
4141 make tests_only
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' && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.repository_owner == 'supabase' }}
4544 runs-on : ubuntu-latest
46- name : " supabase_auth: 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 : " supabase_auth: Publish to PyPi"
4779 environment :
4880 name : pypi
4981 url : https://pypi.org/p/supabase_auth
5082 permissions :
5183 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
5284 contents : write # needed for dependabot to write to repo
53- outputs :
54- is-released : ${{ steps.release.outputs.released }}
5585 steps :
86+ - name : Set up Python 3.11
87+ uses : actions/setup-python@v5
88+ with :
89+ python-version : 3.11
90+
5691 - name : Clone Repository
5792 uses : actions/checkout@v4
5893 with :
5994 ref : ${{ github.ref }}
6095 fetch-depth : 0
61- token : ${{ secrets.SILENTWORKS_PAT }}
62- # This action uses Python Semantic Release v8
63- - name : Python Semantic Release
64- id : release
65- uses :
python-semantic-release/[email protected] 96+
97+ - name : Set up Poetry
98+ uses : abatilo/actions-poetry@v3
6699 with :
67- 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
68107
69108 - name : Publish package distributions to PyPI
70109 uses : pypa/gh-action-pypi-publish@release/v1
71- # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
72- # See https://github.com/actions/runner/issues/1173
73- if : steps.release.outputs.released == 'true'
74110
75- - name : Publish package distributions to GitHub Releases
76- uses : python-semantic-release/upload-to-gh-release@main
77- if : steps.release.outputs.released == 'true'
78- with :
79- github_token : ${{ secrets.GITHUB_TOKEN }}
80111 publish_legacy :
81112 needs : publish
82- if : ${{ ! startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore' ) && github.ref == 'refs/heads/main' && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.repository_owner == 'supabase' }}
113+ if : ${{ startsWith(github.event.head_commit.message, 'chore(main)' ) && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
83114 runs-on : ubuntu-latest
84- name : " gotrue: Bump version and publish "
115+ name : " gotrue: Publish to PyPi "
85116 environment :
86117 name : pypi
87118 url : https://pypi.org/p/gotrue
88119 permissions :
89120 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
90121 contents : write # needed for github actions bot to write to repo
91122 steps :
123+ - name : Set up Python 3.11
124+ uses : actions/setup-python@v5
125+ with :
126+ python-version : 3.11
127+
92128 - name : Clone Repository
93129 uses : actions/checkout@v4
94130 with :
95131 ref : ${{ github.ref }}
96132 fetch-depth : 0
97- token : ${{ secrets.SILENTWORKS_PAT }}
98133
99134 - name : Rename Project
100135 id : rename_project
101136 run : make rename_project
102137
103- - name : Install poetry
138+ - name : Set up Poetry
104139 uses : abatilo/actions-poetry@v3
140+ with :
141+ poetry-version : 1.8.3
142+
105143 - name : Setup a local virtual environment (if no poetry.toml file)
106144 run : |
107145 poetry config virtualenvs.create true --local
108146 poetry config virtualenvs.in-project true --local
147+
109148 - uses : actions/cache@v4
110149 name : Define a cache for the virtual environment based on the dependencies lock file
111150 with :
112151 path : ./.venv
113152 key : venv-${{ hashFiles('poetry.lock') }}
153+
114154 - name : Install the project dependencies
115155 run : poetry install
116156
117- - name : Build package distribution directory
118- id : build_dist
119- run : make build_package
157+ - name : Build package dist directory
158+ run : poetry build
120159
121160 - name : Publish package distributions to PyPI
122161 uses : pypa/gh-action-pypi-publish@release/v1
123- # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
124- # See https://github.com/actions/runner/issues/1173
125- if : needs.publish.outputs.is-released == 'true'
0 commit comments