44 BRANCH : ${{ github.ref_name }}
55
66on :
7+ pull-request :
78 push :
89 # Sequence of patterns matched against refs/tags
910 tags :
@@ -13,48 +14,48 @@ jobs:
1314 tests :
1415 uses : ./.github/workflows/ci-tests.yaml
1516
16- release_checks :
17- name : Checks before pkg build
18- runs-on : ubuntu-latest
19- timeout-minutes : 5
20- strategy :
21- fail-fast : true
22- steps :
23- - id : checkout
24- name : Checkout repo
25- uses : actions/checkout@v4
26- with :
27- ref : ${{ env.BRANCH }}
28- fetch-depth : 0
29- - id : setup_python
30- name : Setup Python
31- uses : actions/setup-python@v5.3.0
32- with :
33- python-version : " 3.10"
34- architecture : x64
35- - id : install_environment
36- name : Set up build environment
37- run : |
38- make setup
17+ # release_checks:
18+ # name: Checks before pkg build
19+ # runs-on: ubuntu-latest
20+ # timeout-minutes: 5
21+ # strategy:
22+ # fail-fast: true
23+ # steps:
24+ # - id: checkout
25+ # name: Checkout repo
26+ # uses: actions/checkout@v4
27+ # with:
28+ # ref: ${{ env.BRANCH }}
29+ # fetch-depth: 0
30+ # - id: setup_python
31+ # name: Setup Python
32+ # uses: actions/setup-python@v5.3.0
33+ # with:
34+ # python-version: "3.10"
35+ # architecture: x64
36+ # - id: install_environment
37+ # name: Set up build environment
38+ # run: |
39+ # make setup
3940
40- - id : package_metadata
41- name : Fetch package metadata
42- run : |
43- NAME=$(poetry version | awk '{print $1}')
44- VERSION=$(poetry version | awk '{print $2}')
45- echo "name=$NAME" >> "$GITHUB_OUTPUT"
46- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
41+ # - id: package_metadata
42+ # name: Fetch package metadata
43+ # run: |
44+ # NAME=$(poetry version | awk '{print $1}')
45+ # VERSION=$(poetry version | awk '{print $2}')
46+ # echo "name=$NAME" >> "$GITHUB_OUTPUT"
47+ # echo "version=$VERSION" >> "$GITHUB_OUTPUT"
4748
48- - id : version_vs_tag_check
49- name : Check if tag version matches project version
50- run : |
51- VERSION=${{ steps.package_metadata.outputs.version }}
52- BRANCH=${{ env.BRANCH }}
53- if [[ "$BRANCH" != "v$VERSION" ]]; then exit 1; fi
49+ # - id: version_vs_tag_check
50+ # name: Check if tag version matches project version
51+ # run: |
52+ # VERSION=${{ steps.package_metadata.outputs.version }}
53+ # BRANCH=${{ env.BRANCH }}
54+ # if [[ "$BRANCH" != "v$VERSION" ]]; then exit 1; fi
5455
55- outputs :
56- package_name : ${{ steps.package_metadata.outputs.name }}
57- package_version : ${{ steps.package_metadata.outputs.version }}
56+ # outputs:
57+ # package_name: ${{ steps.package_metadata.outputs.name }}
58+ # package_version: ${{ steps.package_metadata.outputs.version }}
5859
5960 build :
6061 name : Build package
@@ -80,87 +81,112 @@ jobs:
8081 name : distfiles
8182 path : dist/
8283
83- autorelease :
84- name : Release the package on github
85- needs : [release_checks, tests, build]
86- runs-on : ubuntu-latest
87- timeout-minutes : 5
88- strategy :
89- fail-fast : true
90- steps :
91- - id : checkout
92- name : Checkout repo
93- uses : actions/checkout@v4
94- with :
95- ref : ${{ env.BRANCH }}
96- fetch-depth : 0
97- - name : Download all the dists
98- uses : actions/download-artifact@v4
99- with :
100- name : distfiles
101- path : dist/
102- - id : artifact_names
103- name : Compute artifact names outputs
104- run : |
105- _NAME=${{ needs.release_checks.outputs.package_name }}
106- _VERSION=${{ needs.release_checks.outputs.package_version }}
107- echo "wheel=${_NAME}-${_VERSION}-py3-none-any.whl" >> "$GITHUB_OUTPUT"
108- echo "tarball=${_NAME}-${_VERSION}.tar.gz" >> "$GITHUB_OUTPUT"
109- - name : Create Github Release
110- uses : softprops/action-gh-release@v2
111- env :
112- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
113- with :
114- body_path : " .github/RELEASE-TEMPLATE.md"
115- files : |
116- dist/${{ steps.artifact_names.outputs.wheel }}
117- dist/${{ steps.artifact_names.outputs.tarball }}
118- outputs :
119- version : ${{ needs.release_checks.outputs.package_version }}
120- wheel : ${{ steps.artifact_names.outputs.wheel }}
121- tarball : ${{ steps.artifact_names.outputs.tarball }}
12284
123- upload-pypi :
124- name : Publish to PyPI
125- needs : [release_checks, tests, build]
85+ publish-to-testpypi :
86+ name : Publish Python 🐍 distribution 📦 to TestPyPI
87+ needs :
88+ - build
12689 runs-on : ubuntu-latest
127- steps :
128- - name : Download all the dists
129- uses : actions/download-artifact@v4
130- with :
131- name : distfiles
132- path : dist/
133- - name : Publish to PyPI
134- uses : pypa/gh-action-pypi-publish@release/v1
90+
91+ environment :
92+ name : testpypi
93+ url : https://test.pypi.org/p/<package-name>
94+
13595 permissions :
136- id-token : write # Needed for trusted publishing (https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/)
96+ id-token : write # IMPORTANT: mandatory for trusted publishing
13797
138- test :
139- name : Test Release
140- runs-on : ubuntu-latest
141- timeout-minutes : 5
142- env :
143- DOWNLOADS_PATH : " /releases/download"
144- needs : [autorelease]
14598 steps :
146- - id : check-tar-gz
147- name : Check tar.gz package
148- run : |
149- # check if release is now published and available
150- TARBALL=${{ needs.autorelease.outputs.tarball }}
151- VERSION=${{ needs.autorelease.outputs.version }}
152- echo "Checking latest available Spark package release: ${TARBALL}"
153- STATUSCODE=$(curl --silent --head $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/${{ env.DOWNLOADS_PATH }}/v${VERSION}/${TARBALL} | head -n 1 | cut -d' ' -f2)
154- if [[ ${STATUSCODE} -ne 200 ]] && [[ ${STATUSCODE} -ne 302 ]]; then exit 1; fi
155- - id : download-package
156- name : Download wheel package
157- run : |
158- # check if release is now published and available
159- WHEEL=${{ needs.autorelease.outputs.wheel }}
160- VERSION=${{ needs.autorelease.outputs.version }}
161- echo "Downloading latest available Spark wheel package release ${WHEEL}."
162- wget $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/${{ env.DOWNLOADS_PATH }}/v${VERSION}/${WHEEL} --no-check-certificate
163- - id : install-package
164- name : Install wheel package file
165- run : |
166- pip install ./${{ needs.autorelease.outputs.wheel }}
99+ - name : Download all the dists
100+ uses : actions/download-artifact@v4
101+ with :
102+ name : python-package-distributions
103+ path : dist/
104+ - name : Publish distribution 📦 to TestPyPI
105+ uses : pypa/gh-action-pypi-publish@release/v1
106+ with :
107+ repository-url : https://test.pypi.org/legacy/
108+
109+ # autorelease:
110+ # name: Release the package on github
111+ # needs: [release_checks, tests, build]
112+ # runs-on: ubuntu-latest
113+ # timeout-minutes: 5
114+ # strategy:
115+ # fail-fast: true
116+ # steps:
117+ # - id: checkout
118+ # name: Checkout repo
119+ # uses: actions/checkout@v4
120+ # with:
121+ # ref: ${{ env.BRANCH }}
122+ # fetch-depth: 0
123+ # - name: Download all the dists
124+ # uses: actions/download-artifact@v4
125+ # with:
126+ # name: distfiles
127+ # path: dist/
128+ # - id: artifact_names
129+ # name: Compute artifact names outputs
130+ # run: |
131+ # _NAME=${{ needs.release_checks.outputs.package_name }}
132+ # _VERSION=${{ needs.release_checks.outputs.package_version }}
133+ # echo "wheel=${_NAME}-${_VERSION}-py3-none-any.whl" >> "$GITHUB_OUTPUT"
134+ # echo "tarball=${_NAME}-${_VERSION}.tar.gz" >> "$GITHUB_OUTPUT"
135+ # - name: Create Github Release
136+ # uses: softprops/action-gh-release@v2
137+ # env:
138+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+ # with:
140+ # body_path: ".github/RELEASE-TEMPLATE.md"
141+ # files: |
142+ # dist/${{ steps.artifact_names.outputs.wheel }}
143+ # dist/${{ steps.artifact_names.outputs.tarball }}
144+ # outputs:
145+ # version: ${{ needs.release_checks.outputs.package_version }}
146+ # wheel: ${{ steps.artifact_names.outputs.wheel }}
147+ # tarball: ${{ steps.artifact_names.outputs.tarball }}
148+
149+ # upload-pypi:
150+ # name: Publish to PyPI
151+ # needs: [release_checks, tests, build]
152+ # runs-on: ubuntu-latest
153+ # steps:
154+ # - name: Download all the dists
155+ # uses: actions/download-artifact@v4
156+ # with:
157+ # name: distfiles
158+ # path: dist/
159+ # - name: Publish to PyPI
160+ # uses: pypa/gh-action-pypi-publish@release/v1
161+ # permissions:
162+ # id-token: write # Needed for trusted publishing (https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/)
163+
164+ # test:
165+ # name: Test Release
166+ # runs-on: ubuntu-latest
167+ # timeout-minutes: 5
168+ # env:
169+ # DOWNLOADS_PATH: "/releases/download"
170+ # needs: [autorelease]
171+ # steps:
172+ # - id: check-tar-gz
173+ # name: Check tar.gz package
174+ # run: |
175+ # # check if release is now published and available
176+ # TARBALL=${{ needs.autorelease.outputs.tarball }}
177+ # VERSION=${{ needs.autorelease.outputs.version }}
178+ # echo "Checking latest available Spark package release: ${TARBALL}"
179+ # STATUSCODE=$(curl --silent --head $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/${{ env.DOWNLOADS_PATH }}/v${VERSION}/${TARBALL} | head -n 1 | cut -d' ' -f2)
180+ # if [[ ${STATUSCODE} -ne 200 ]] && [[ ${STATUSCODE} -ne 302 ]]; then exit 1; fi
181+ # - id: download-package
182+ # name: Download wheel package
183+ # run: |
184+ # # check if release is now published and available
185+ # WHEEL=${{ needs.autorelease.outputs.wheel }}
186+ # VERSION=${{ needs.autorelease.outputs.version }}
187+ # echo "Downloading latest available Spark wheel package release ${WHEEL}."
188+ # wget $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/${{ env.DOWNLOADS_PATH }}/v${VERSION}/${WHEEL} --no-check-certificate
189+ # - id: install-package
190+ # name: Install wheel package file
191+ # run: |
192+ # pip install ./${{ needs.autorelease.outputs.wheel }}
0 commit comments