1515env :
1616 # Common versions
1717 PYTHON_VERSION : ' 3.14.0' # TODO: Used?
18- HATCH_VERSION : ' 1.14.2'
1918 DOCKER_BUILDX_VERSION : ' v0.26.1'
2019
2120 # These environment variables are important to the Crossplane CLI install.sh
2221 # script. They determine what version it installs.
2322 XP_CHANNEL : stable
2423 # v2.2.0 does not allow functions to include anything but CRDs.
25- XP_VERSION : v2.1 .0
24+ XP_VERSION : v2.2 .0
2625
2726 # This CI job will automatically push new builds to xpkg.upbound.io if the
2827 # XPKG_ACCESS_ID and XPKG_TOKEN secrets are set in the GitHub respository (or
5251 # with:
5352 # python-version: ${{ env.PYTHON_VERSION }}
5453
55- # - name: Setup Hatch
56- # run: pipx install hatch==${{ env.HATCH_VERSION }}
54+ # - name: Install Hatch
55+ # uses: pypa/ hatch@install
5756
5857 # - name: Lint
5958 # run: hatch run lint:check
6968 with :
7069 python-version : ${{ env.PYTHON_VERSION }}
7170
72- - name : Setup Hatch
73- run : pipx install hatch==${{ env.HATCH_VERSION }}
71+ - name : Install Hatch
72+ uses : pypa/ hatch@install
7473
7574 - name : Run Unit Tests
7675 run : hatch run test:ci
@@ -94,38 +93,38 @@ jobs:
9493 build-pypi :
9594 runs-on : ubuntu-24.04
9695 steps :
97- - name : Checkout
98- uses : actions/checkout@v6
99-
100- - name : Setup Python
101- uses : actions/setup-python@v6
102- with :
103- python-version : ${{ env.PYTHON_VERSION }}
104-
105- - name : Setup Hatch
106- run : pipx install hatch==${{ env.HATCH_VERSION }}
107-
108- # If a version wasn't explicitly passed as a workflow_dispatch input we
109- # default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
110- # v0.0.0+20231101115142-1091066df799. This is a simple implementation of
111- # Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
112- - name : Set Default PyPI Project Version
113- if : env.PYPI_VERSION == ''
114- run : echo "PYPI_VERSION=v0.0.0+$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
115-
116- - name : Set PyPI Project Version
117- run : hatch version ${{ env.PYPI_VERSION }}
118-
119- - name : Build Sdist and Wheel
120- run : hatch build
121-
122- - name : Upload Sdist and Wheel to GitHub
123- uses : actions/upload-artifact@v7
124- with :
125- name : dist
126- path : " dist/*"
127- if-no-files-found : error
128- retention-days : 1
96+ - name : Checkout
97+ uses : actions/checkout@v6
98+
99+ - name : Setup Python
100+ uses : actions/setup-python@v6
101+ with :
102+ python-version : ${{ env.PYTHON_VERSION }}
103+
104+ - name : Install Hatch
105+ uses : pypa/ hatch@install
106+
107+ # If a version wasn't explicitly passed as a workflow_dispatch input we
108+ # default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
109+ # v0.0.0+20231101115142-1091066df799. This is a simple implementation of
110+ # Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
111+ - name : Set Default PyPI Project Version
112+ if : env.PYPI_VERSION == ''
113+ run : echo "PYPI_VERSION=v0.0.0+$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
114+
115+ - name : Set PyPI Project Version
116+ run : hatch version ${{ env.PYPI_VERSION }}
117+
118+ - name : Build Sdist and Wheel
119+ run : hatch build
120+
121+ - name : Upload Sdist and Wheel to GitHub
122+ uses : actions/upload-artifact@v7
123+ with :
124+ name : dist
125+ path : " dist/*"
126+ if-no-files-found : error
127+ retention-days : 1
129128
130129 # We want to build most packages for the amd64 and arm64 architectures. To
131130 # speed this up we build single-platform packages in parallel. We then upload
@@ -142,55 +141,55 @@ jobs:
142141 - amd64
143142 - arm64
144143 steps :
145- - name : Setup QEMU
146- uses : docker/setup-qemu-action@v4
147- with :
148- platforms : all
149-
150- - name : Setup Docker Buildx
151- uses : docker/setup-buildx-action@v4
152- with :
153- version : ${{ env.DOCKER_BUILDX_VERSION }}
154- install : true
155-
156- - name : Checkout
157- uses : actions/checkout@v6
158-
159- - name : Download Wheel from GitHub
160- uses : actions/download-artifact@v8
161- with :
162- name : dist
163- pattern : ' *.whl'
164- path : dist
165-
166- # We ask Docker to use GitHub Action's native caching support to speed up
167- # the build, per https://docs.docker.com/build/cache/backends/gha/.
168- - name : Build Runtime
169- id : image
170- uses : docker/build-push-action@v7
171- with :
172- context : .
173- platforms : linux/${{ matrix.arch }}
174- cache-from : type=gha
175- cache-to : type=gha,mode=max
176- target : image
177- build-args :
178- PYTHON_VERSION=${{ env.PYTHON_VERSION }}
179- outputs : type=docker,dest=runtime-${{ matrix.arch }}.tar
180-
181- - name : Setup the Crossplane CLI
182- run : " mkdir bin && cd bin && curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
183-
184- - name : Build Package
185- run : bin/crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar
186-
187- - name : Upload Single-Platform Package
188- uses : actions/upload-artifact@v7
189- with :
190- name : package-${{ matrix.arch }}
191- path : " *.xpkg"
192- if-no-files-found : error
193- retention-days : 1
144+ - name : Setup QEMU
145+ uses : docker/setup-qemu-action@v4
146+ with :
147+ platforms : all
148+
149+ - name : Setup Docker Buildx
150+ uses : docker/setup-buildx-action@v4
151+ with :
152+ version : ${{ env.DOCKER_BUILDX_VERSION }}
153+ install : true
154+
155+ - name : Checkout
156+ uses : actions/checkout@v6
157+
158+ - name : Download Wheel from GitHub
159+ uses : actions/download-artifact@v8
160+ with :
161+ name : dist
162+ pattern : ' *.whl'
163+ path : dist
164+
165+ # We ask Docker to use GitHub Action's native caching support to speed up
166+ # the build, per https://docs.docker.com/build/cache/backends/gha/.
167+ - name : Build Runtime
168+ id : image
169+ uses : docker/build-push-action@v7
170+ with :
171+ context : .
172+ platforms : linux/${{ matrix.arch }}
173+ cache-from : type=gha
174+ cache-to : type=gha,mode=max
175+ target : image
176+ build-args :
177+ PYTHON_VERSION=${{ env.PYTHON_VERSION }}
178+ outputs : type=docker,dest=runtime-${{ matrix.arch }}.tar
179+
180+ - name : Setup the Crossplane CLI
181+ run : " mkdir bin && cd bin && curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
182+
183+ - name : Build Package
184+ run : bin/crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar
185+
186+ - name : Upload Single-Platform Package
187+ uses : actions/upload-artifact@v7
188+ with :
189+ name : package-${{ matrix.arch }}
190+ path : " *.xpkg"
191+ if-no-files-found : error
192+ retention-days : 1
194193
195194 publish-pypi :
196195 # Don't publish unless we were run with an explicit version.
@@ -199,20 +198,20 @@ jobs:
199198 - build-xpkg # only publish if xpkg builds succeeds
200199 runs-on : ubuntu-24.04
201200 steps :
202- - name : Download Sdist and Wheel from GitHub
203- uses : actions/download-artifact@v8
204- with :
205- name : dist
206- path : dist
201+ - name : Download Sdist and Wheel from GitHub
202+ uses : actions/download-artifact@v8
203+ with :
204+ name : dist
205+ path : dist
207206
208- - name : Setup Hatch
209- run : pipx install hatch==${{ env.HATCH_VERSION }}
207+ - name : Install Hatch
208+ uses : pypa/ hatch@install
210209
211- - name : Publish to PyPI
212- env :
213- HATCH_INDEX_USER : __token__
214- HATCH_INDEX_AUTH : ${{ secrets.PYPI_API_TOKEN }}
215- run : hatch publish --no-prompt
210+ - name : Publish to PyPI
211+ env :
212+ HATCH_INDEX_USER : __token__
213+ HATCH_INDEX_AUTH : ${{ secrets.PYPI_API_TOKEN }}
214+ run : hatch publish --no-prompt
216215
217216 # This job downloads the single-platform packages built by the build job, and
218217 # pushes them as a multi-platform package. We only push the package it the
@@ -227,46 +226,46 @@ jobs:
227226 contents : read
228227 packages : write
229228 steps :
230- - name : Checkout
231- uses : actions/checkout@v6
232-
233- - name : Download Single-Platform Packages
234- uses : actions/download-artifact@v8
235- with :
236- # See https://github.com/docker/build-push-action/blob/263435/README.md#summaries
237- pattern : " !*.dockerbuild"
238- path : .
239- merge-multiple : true
240-
241- - name : Setup the Crossplane CLI
242- run : " mkdir bin && cd bin && curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
243-
244- # If a version wasn't explicitly passed as a workflow_dispatch input we
245- # default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
246- # v0.0.0-20231101115142-1091066df799. This is a simple implementation of
247- # Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
248- - name : Set Default Multi-Platform Package Version
249- if : env.XPKG_VERSION == ''
250- run : echo "XPKG_VERSION=v0.0.0-$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
251-
252- - name : Login to Upbound
253- uses : docker/login-action@v4
254- if : env.XPKG_ACCESS_ID != ''
255- with :
256- registry : xpkg.upbound.io
257- username : ${{ secrets.XPKG_ACCESS_ID }}
258- password : ${{ secrets.XPKG_TOKEN }}
259-
260- - name : Push Multi-Platform Package to Upbound
261- if : env.XPKG_ACCESS_ID != ''
262- run : " bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}"
263-
264- - name : Login to GHCR
265- uses : docker/login-action@v4
266- with :
267- registry : ghcr.io
268- username : ${{ github.repository_owner }}
269- password : ${{ secrets.GITHUB_TOKEN }}
270-
271- - name : Push Multi-Platform Package to GHCR
272- run : " bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}"
229+ - name : Checkout
230+ uses : actions/checkout@v6
231+
232+ - name : Download Single-Platform Packages
233+ uses : actions/download-artifact@v8
234+ with :
235+ # See https://github.com/docker/build-push-action/blob/263435/README.md#summaries
236+ pattern : " !*.dockerbuild"
237+ path : .
238+ merge-multiple : true
239+
240+ - name : Setup the Crossplane CLI
241+ run : " mkdir bin && cd bin && curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
242+
243+ # If a version wasn't explicitly passed as a workflow_dispatch input we
244+ # default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
245+ # v0.0.0-20231101115142-1091066df799. This is a simple implementation of
246+ # Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
247+ - name : Set Default Multi-Platform Package Version
248+ if : env.XPKG_VERSION == ''
249+ run : echo "XPKG_VERSION=v0.0.0-$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
250+
251+ - name : Login to Upbound
252+ uses : docker/login-action@v4
253+ if : env.XPKG_ACCESS_ID != ''
254+ with :
255+ registry : xpkg.upbound.io
256+ username : ${{ secrets.XPKG_ACCESS_ID }}
257+ password : ${{ secrets.XPKG_TOKEN }}
258+
259+ - name : Push Multi-Platform Package to Upbound
260+ if : env.XPKG_ACCESS_ID != ''
261+ run : " bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}"
262+
263+ - name : Login to GHCR
264+ uses : docker/login-action@v4
265+ with :
266+ registry : ghcr.io
267+ username : ${{ github.repository_owner }}
268+ password : ${{ secrets.GITHUB_TOKEN }}
269+
270+ - name : Push Multi-Platform Package to GHCR
271+ run : " bin/crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}"
0 commit comments