2222 XP_CHANNEL : master # TODO(negz): Pin to stable once v1.14 is released.
2323 XP_VERSION : current # TODO(negz): Pin to a version once v1.14 is released.
2424
25- # The package to push to GHCR
25+ # This CI job will automatically push new builds to xpkg.upbound.io if the
26+ # XPKG_ACCESS_ID and XPKG_TOKEN secrets are set in the GitHub respository (or
27+ # organization) settings.
28+ XPKG_ACCESS_ID : ${{ secrets.XPKG_ACCESS_ID }}
29+
30+ # The package to push to GHCR and upbound.io
31+ XPKG : xpkg.upbound.io/${{ github.repository}}
2632 CROSSPLANE_REGORG : ghcr.io/${{ github.repository}}
2733
2834 # The package version to push. The default is 0.0.0-gitsha.
6672 # We want to build most packages for the amd64 and arm64 architectures. To
6773 # speed this up we build single-platform packages in parallel. We then upload
6874 # those packages to GitHub as a build artifact. The push job downloads those
69- # artifacts and pushes them as a single multi-platform package.
75+ # artifacts and pushes them as a single multi-platform package.
7076 build :
7177 runs-on : ubuntu-24.04
7278 strategy :
@@ -104,13 +110,13 @@ jobs:
104110 build-args :
105111 PYTHON_VERSION=${{ env.PYTHON_VERSION }}
106112 outputs : type=docker,dest=runtime-${{ matrix.arch }}.tar
107-
113+
108114 - name : Setup the Crossplane CLI
109115 run : " curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
110116
111117 - name : Build Package
112118 run : ./crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar
113-
119+
114120 - name : Upload Single-Platform Package
115121 uses : actions/upload-artifact@v6
116122 with :
@@ -133,14 +139,21 @@ jobs:
133139 - name : Download Single-Platform Packages
134140 uses : actions/download-artifact@v7
135141 with :
136- # See https://github.com/docker/build-push-action/blob/263435/README.md#summaries
137- pattern : " !*.dockerbuild"
138142 path : .
139143 merge-multiple : true
144+ pattern : " !*.dockerbuild" # This gets uploaded by docker/build-push-action but must be skipped: https://github.com/actions/toolkit/pull/1874
140145
141146 - name : Setup the Crossplane CLI
142147 run : " curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
143148
149+ - name : Login to Upbound
150+ uses : docker/login-action@v3
151+ if : env.XPKG_ACCESS_ID != ''
152+ with :
153+ registry : xpkg.upbound.io
154+ username : ${{ secrets.XPKG_ACCESS_ID }}
155+ password : ${{ secrets.XPKG_TOKEN }}
156+
144157 # If a version wasn't explicitly passed as a workflow_dispatch input we
145158 # default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
146159 # v0.0.0-20231101115142-1091066df799. This is a simple implementation of
@@ -149,6 +162,10 @@ jobs:
149162 if : env.XPKG_VERSION == ''
150163 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
151164
165+ - name : Push Multi-Platform Package to Upbound
166+ if : env.XPKG_ACCESS_ID != ''
167+ run : " ./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}"
168+
152169 - name : Login to GHCR
153170 uses : docker/login-action@v3
154171 with :
0 commit comments