@@ -34,86 +34,122 @@ jobs:
3434
3535 - name : Upload Coverage
3636 uses : codecov/codecov-action@v4
37- publish :
37+ release-please :
3838 needs : test
39- 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' }}
4039 runs-on : ubuntu-latest
41- name : " supabase_functions: Bump version, create changelog and publish"
40+ name : " Bump version and create changelog"
41+ permissions :
42+ id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
43+ contents : write # needed for github actions bot to write to repo
44+ pull-requests : write
45+ steps :
46+ - uses : googleapis/release-please-action@v4
47+ id : release
48+ with :
49+ target-branch : ${{ github.ref_name }}
50+
51+ - if : ${{ steps.release.outputs }}
52+ id : versions
53+ run : |
54+ set -ex
55+
56+ MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
57+ RELEASE_VERSION="$MAIN_RELEASE_VERSION"
58+ RELEASE_NAME="v$RELEASE_VERSION"
59+ RELEASE_CREATED='${{ steps.release.outputs.release_created }}'
60+ PRS_CREATED='${{ steps.release.outputs.prs_created }}'
61+ PR_TITLE='${{ github.event.head_commit.message }}'
62+
63+ echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
64+ echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
65+ echo "RELEASE_CREATED=${RELEASE_CREATED}" >> "${GITHUB_OUTPUT}"
66+ echo "RELEASE_NAME=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}"
67+ echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}"
68+ echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_OUTPUT}"
69+ publish :
70+ needs : release-please
71+ if : ${{ startsWith(github.event.head_commit.message, 'chore(main)') && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
72+ runs-on : ubuntu-latest
73+ name : " supabase_functions: Publish to PyPi"
4274 environment :
4375 name : pypi
4476 url : https://pypi.org/p/supabase_functions
4577 permissions :
4678 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
4779 contents : write # needed for github actions bot to write to repo
48- outputs :
49- is-released : ${{ steps.release.outputs.released }}
5080 steps :
81+ - name : Set up Python 3.11
82+ uses : actions/setup-python@v5
83+ with :
84+ python-version : 3.11
85+
5186 - name : Clone Repository
5287 uses : actions/checkout@v4
5388 with :
5489 ref : ${{ github.ref }}
5590 fetch-depth : 0
56- token : ${{ secrets.SILENTWORKS_PAT }}
57- - name : Python Semantic Release
58- id : release
59- uses :
python-semantic-release/[email protected] 91+
92+ - name : Set up Poetry
93+ uses : abatilo/actions-poetry@v3
6094 with :
61- github_token : ${{ secrets.GITHUB_TOKEN }}
95+ poetry-version : 1.8.3
96+
97+ - name : Install dependencies
98+ run : poetry install
99+
100+ - name : Build package dist directory
101+ run : poetry build
62102
63103 - name : Publish package distributions to PyPI
64104 uses : pypa/gh-action-pypi-publish@release/v1
65- # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
66- # See https://github.com/actions/runner/issues/1173
67- if : steps.release.outputs.released == 'true'
68-
69- - name : Publish package distributions to GitHub Releases
70- uses : python-semantic-release/upload-to-gh-release@main
71- if : steps.release.outputs.released == 'true'
72- with :
73- github_token : ${{ secrets.GITHUB_TOKEN }}
74105 publish_legacy :
75106 needs : publish
76- 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' }}
107+ if : ${{ startsWith(github.event.head_commit.message, 'chore(main)' ) && github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
77108 runs-on : ubuntu-latest
78- name : " supafunc: Bump version and publish "
109+ name : " supafunc: Publish to PyPi "
79110 environment :
80111 name : pypi
81112 url : https://pypi.org/p/supafunc
82113 permissions :
83114 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
84115 contents : write # needed for github actions bot to write to repo
85116 steps :
117+ - name : Set up Python 3.11
118+ uses : actions/setup-python@v5
119+ with :
120+ python-version : 3.11
121+
86122 - name : Clone Repository
87123 uses : actions/checkout@v4
88124 with :
89125 ref : ${{ github.ref }}
90126 fetch-depth : 0
91- token : ${{ secrets.SILENTWORKS_PAT }}
92127
93128 - name : Rename Project
94129 id : rename_project
95130 run : make rename_project
96131
97- - name : Install poetry
132+ - name : Set up Poetry
98133 uses : abatilo/actions-poetry@v3
134+ with :
135+ poetry-version : 1.8.3
136+
99137 - name : Setup a local virtual environment (if no poetry.toml file)
100138 run : |
101139 poetry config virtualenvs.create true --local
102140 poetry config virtualenvs.in-project true --local
141+
103142 - uses : actions/cache@v4
104143 name : Define a cache for the virtual environment based on the dependencies lock file
105144 with :
106145 path : ./.venv
107146 key : venv-${{ hashFiles('poetry.lock') }}
147+
108148 - name : Install the project dependencies
109149 run : poetry install
110150
111- - name : Build package distribution directory
112- id : build_dist
113- run : make build_package
151+ - name : Build package dist directory
152+ run : poetry build
114153
115154 - name : Publish package distributions to PyPI
116155 uses : pypa/gh-action-pypi-publish@release/v1
117- # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
118- # See https://github.com/actions/runner/issues/1173
119- if : needs.publish.outputs.is-released == 'true'
0 commit comments