Skip to content

Commit 429fd52

Browse files
committed
Push to GHCR from main, release branches, and tags
Signed-off-by: Nic Cope <nicc@rk0n.org>
1 parent 313ddd4 commit 429fd52

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,8 @@ env:
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-
# 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. Create a token at https://accounts.upbound.io.
28-
XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }}
29-
30-
# The package to push, without a version tag. The default matches GitHub. For
31-
# example xpkg.upbound.io/crossplane/function-template-go.
32-
XPKG: xpkg.upbound.io/${{ github.repository}}
33-
CROSSPLANE_REGORG: ghcr.io/${{ github.repository}} # xpkg.crossplane.io/crossplane-contrib
25+
# The package to push to GHCR
26+
CROSSPLANE_REGORG: ghcr.io/${{ github.repository}}
3427

3528
# The package version to push. The default is 0.0.0-gitsha.
3629
XPKG_VERSION: ${{ inputs.version }}
@@ -148,14 +141,6 @@ jobs:
148141
- name: Setup the Crossplane CLI
149142
run: "curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh"
150143

151-
- name: Login to Upbound
152-
uses: docker/login-action@v3
153-
if: env.XPKG_ACCESS_ID != ''
154-
with:
155-
registry: xpkg.upbound.io
156-
username: ${{ secrets.XPKG_ACCESS_ID }}
157-
password: ${{ secrets.XPKG_TOKEN }}
158-
159144
# If a version wasn't explicitly passed as a workflow_dispatch input we
160145
# default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
161146
# v0.0.0-20231101115142-1091066df799. This is a simple implementation of
@@ -164,10 +149,6 @@ jobs:
164149
if: env.XPKG_VERSION == ''
165150
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
166151

167-
- name: Push Multi-Platform Package to Upbound
168-
if: env.XPKG_ACCESS_ID != ''
169-
run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}"
170-
171152
- name: Login to GHCR
172153
uses: docker/login-action@v3
173154
with:
@@ -176,5 +157,5 @@ jobs:
176157
password: ${{ secrets.GITHUB_TOKEN }}
177158

178159
- name: Push Multi-Platform Package to GHCR
179-
if: env.XPKG_ACCESS_ID != ''
160+
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'crossplane-contrib'
180161
run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}"

0 commit comments

Comments
 (0)