Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ env:
XP_CHANNEL: stable
XP_VERSION: current

# This CI job will automatically push new builds to xpkg.upbound.io if the
# XPKG_ACCESS_ID and XPKG_TOKEN secrets are set in the GitHub repository (or
# organization) settings. Create a token at https://accounts.upbound.io.
XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }}

# The OCI/Docker Repository to push our images to.
# By Default this points to Github Package Registry.
XPKG_REPO: ghcr.io/${{ github.repository_owner }}

# The example template pushes to Upbound Marketplace
# To push to Upbound marketplace.
#XPKG_REPO: xpkg.upbound.io/${{ github.repository_owner }}

# Names for the Configuration and corresponding Function Packages
Expand Down Expand Up @@ -217,6 +212,9 @@ jobs:
# pushes them as a multi-platform package. We only push the package it the
# XPKG_ACCESS_ID and XPKG_TOKEN secrets were provided.
push:
permissions:
contents: read
packages: write
runs-on: *default-runner
needs:
- version
Expand All @@ -239,32 +237,32 @@ jobs:
uses: crossplane-contrib/setup-crossplane-action@cb8aac3f1246b19f101e7f85fd0a38623b4d5ad3 #v0.1.1
with:
version: ${{env.XP_VERSION}}

- name: Login to Upbound

- name: Login to GitHub Container Registry
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
if: env.XPKG_ACCESS_ID != ''
with:
registry: xpkg.upbound.io
username: ${{ secrets.XPKG_ACCESS_ID }}
password: ${{ secrets.XPKG_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Multi-Platform Function Packages to Upbound
if: env.XPKG_ACCESS_ID != ''
- name: Push Multi-Platform Function Packages to Repository
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
FN_XPKG_FILES=$(echo "${{env.XPKG_FN_NAME}}"-*-${{needs.version.outputs.version}}.xpkg | tr ' ' ',')
if [ -z "${FN_XPKG_FILES}" ] || [ "${FN_XPKG_FILES}" = "${{env.XPKG_FN_NAME}}-*-${{needs.version.outputs.version}}.xpkg" ]; then
echo "Error: No xpkg files found matching pattern"
exit 1
fi
crossplane --verbose xpkg push --package-files ${FN_XPKG_FILES} ${{env.XPKG_REPO}}/${{env.XPKG_FN_NAME}}:${{needs.version.outputs.version}}
crossplane --verbose xpkg push --package-files ${FN_XPKG_FILES} ${XPKG_REPO@L}/${{env.XPKG_FN_NAME}}:${{needs.version.outputs.version}}

- name: Push Configuration Package to Upbound
if: env.XPKG_ACCESS_ID != ''
- name: Push Configuration Package to Repository
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
CONF_XPKG_FILE="${{env.XPKG_NAME}}-${{needs.version.outputs.version}}.xpkg"
if [ ! -f "${CONF_XPKG_FILE}" ]; then
echo "Error: Configuration package ${CONF_XPKG_FILE} not found"
exit 1
fi
crossplane --verbose xpkg push --package-files ${CONF_XPKG_FILE} ${{env.XPKG_REPO}}/${{env.XPKG_NAME}}:${{needs.version.outputs.version}}
crossplane --verbose xpkg push --package-files ${CONF_XPKG_FILE} ${XPKG_REPO@L}/${{env.XPKG_NAME}}:${{needs.version.outputs.version}}