Update k8s dependencies to 1.31 (#107) #276
This file contains 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: release | |
on: | |
workflow_dispatch: | |
merge_group: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-cache: | |
strategy: | |
matrix: | |
arch: | |
- amd64 | |
- arm64 | |
- ppc64le | |
- s390x | |
platform: [linux] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# The Dockerfile expects that ansible-operator will be copied from the | |
# build context. We stub it here and then don't cache it. When Goreleaser | |
# runs, it should copy over the right file. | |
- name: Create ansible-operator stub | |
run: echo stubbed-in-ci >> ansible-operator | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: "${{ matrix.platform }}/${{ matrix.arch }}" | |
push: false | |
tags: "cache:${{ matrix.platform }}-${{ matrix.arch }}" | |
file: images/ansible-operator/Dockerfile | |
cache-from: type=gha,scope=${{ matrix.arch }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.arch }} | |
no-cache-filters: final # don't cache this because the stubbed ansible-operator bin was copied in. | |
goreleaser: | |
needs: [build-cache] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Docker Login | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: setup-buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set the release related variables | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
# Release tags. | |
echo IMAGE_TAG="${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
echo GORELEASER_ARGS="--clean --timeout=120m" >> $GITHUB_ENV | |
echo ENABLE_RELEASE_PIPELINE=true >> $GITHUB_ENV | |
elif [[ $GITHUB_REF == refs/heads/* ]]; then | |
# Branch build. | |
echo IMAGE_TAG="$(echo "${GITHUB_REF#refs/heads/}" | sed -r 's|/+|-|g')" >> $GITHUB_ENV | |
echo GORELEASER_ARGS="--clean --skip-validate --timeout=120m" >> $GITHUB_ENV | |
elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
# PR build. | |
echo IMAGE_TAG="pr-$(echo "${GITHUB_REF}" | sed -E 's|refs/pull/([^/]+)/?.*|\1|')" >> $GITHUB_ENV | |
else | |
echo IMAGE_TAG="$(git describe --tags --always)" >> $GITHUB_ENV | |
fi | |
# This gives us ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL | |
# for use in goreleaser | |
- name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v3 | |
- name: Run goreleaser | |
run: make release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
BUILDX_BUILDER: ${{ steps.setup-buildx.outputs.name }} |