chore(deps): update github artifact actions (major) #133
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| pull_request: {} | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Package version (e.g. v0.1.0) | |
| required: false | |
| env: | |
| # Common versions | |
| PYTHON_VERSION: '3.11.5' | |
| DOCKER_BUILDX_VERSION: 'v0.24.0' | |
| # These environment variables are important to the Crossplane CLI install.sh | |
| # script. They determine what version it installs. | |
| XP_CHANNEL: master # TODO(negz): Pin to stable once v1.14 is released. | |
| XP_VERSION: current # TODO(negz): Pin to a version once v1.14 is released. | |
| # The package to push to GHCR | |
| CROSSPLANE_REGORG: ghcr.io/${{ github.repository}} | |
| # The package version to push. The default is 0.0.0-gitsha. | |
| XPKG_VERSION: ${{ inputs.version }} | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Setup Hatch | |
| run: pipx install hatch==1.7.0 | |
| - name: Lint | |
| run: hatch run lint:check | |
| unit-test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Setup Hatch | |
| run: pipx install hatch==1.7.0 | |
| - name: Run Unit Tests | |
| run: hatch run test:unit | |
| # We want to build most packages for the amd64 and arm64 architectures. To | |
| # speed this up we build single-platform packages in parallel. We then upload | |
| # those packages to GitHub as a build artifact. The push job downloads those | |
| # artifacts and pushes them as a single multi-platform package. | |
| build: | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| arch: | |
| - amd64 | |
| - arm64 | |
| steps: | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| version: ${{ env.DOCKER_BUILDX_VERSION }} | |
| install: true | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| # We ask Docker to use GitHub Action's native caching support to speed up | |
| # the build, per https://docs.docker.com/build/cache/backends/gha/. | |
| - name: Build Runtime | |
| id: image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/${{ matrix.arch }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| target: image | |
| build-args: | |
| PYTHON_VERSION=${{ env.PYTHON_VERSION }} | |
| outputs: type=docker,dest=runtime-${{ matrix.arch }}.tar | |
| - name: Setup the Crossplane CLI | |
| run: "curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh" | |
| - name: Build Package | |
| run: ./crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar | |
| - name: Upload Single-Platform Package | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: package-${{ matrix.arch }} | |
| path: "*.xpkg" | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # This job downloads the single-platform packages built by the build job, and | |
| # pushes them as a multi-platform package. We only push the package it the | |
| # XPKG_ACCESS_ID and XPKG_TOKEN secrets were provided. | |
| push: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Download Single-Platform Packages | |
| uses: actions/download-artifact@v6 | |
| with: | |
| # See https://github.com/docker/build-push-action/blob/263435/README.md#summaries | |
| pattern: "!*.dockerbuild" | |
| path: . | |
| merge-multiple: true | |
| - name: Setup the Crossplane CLI | |
| run: "curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh" | |
| # If a version wasn't explicitly passed as a workflow_dispatch input we | |
| # default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example | |
| # v0.0.0-20231101115142-1091066df799. This is a simple implementation of | |
| # Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions. | |
| - name: Set Default Multi-Platform Package Version | |
| if: env.XPKG_VERSION == '' | |
| 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 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push Multi-Platform Package to GHCR | |
| if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'crossplane-contrib' | |
| run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}" |