Skip to content

Build and release versioned container images #2

Build and release versioned container images

Build and release versioned container images #2

Workflow file for this run

---
name: Build and release versioned container images
# yamllint disable-line rule:truthy
on:
create
jobs:
tag_bundle:
name: Build and release the bundle container-image
if: >
github.repository == 'csi-addons/kubernetes-csi-addons'
&&
github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Generate the bundle contents
run: make bundle TAG=${{ github.ref_name }}
- name: Validate the bundle contents
run: make bundle-validate
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build bundle container image
uses: docker/build-push-action@v6
with:
context: .
file: bundle.Dockerfile
push: true
tags: quay.io/csiaddons/k8s-bundle:${{ github.ref_name }}
tag_controller:
name: Build and release the controller container-image
if: >
github.repository == 'csi-addons/kubernetes-csi-addons'
&&
github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push controller container image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: quay.io/csiaddons/k8s-controller:${{ github.ref_name }}
tag_sidecar:
name: Build and release the sidecar container-image
if: >
github.repository == 'csi-addons/kubernetes-csi-addons'
&&
github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push sidecar container image
uses: docker/build-push-action@v6
with:
context: .
file: build/Containerfile.sidecar
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: quay.io/csiaddons/k8s-sidecar:${{ github.ref_name }}
publish_release:
name: Publish a release based on the tag
if: >
github.repository == 'csi-addons/kubernetes-csi-addons'
&&
github.ref_type == 'tag'
needs:
- tag_bundle
- tag_controller
- tag_sidecar
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Generate manifests for installation by kubectl
run: make manifests TAG=${{ github.ref_name }}
- name: Publish the release and attach YAML files
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
artifacts: "deploy/*/*.yaml"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}