Skip to content

feat: implement CreateVolume with loopback image creation via Job #7

feat: implement CreateVolume with loopback image creation via Job

feat: implement CreateVolume with loopback image creation via Job #7

Workflow file for this run

name: Build and Push Image
on:
push:
branches:
- main
paths:
- cmd/**
- internal/**
- Dockerfile
- go.mod
- go.sum
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/csi-driver
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set image tag
id: meta
run: echo "tag=$(echo $GITHUB_SHA | head -c7)" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.IMAGE }}:${{ steps.meta.outputs.tag }}
cache-from: type=registry,ref=${{ env.IMAGE }}:cache
cache-to: type=registry,ref=${{ env.IMAGE }}:cache,mode=max
- name: Checkout home-kubernetes
uses: actions/checkout@v4
with:
repository: tryuuu/home-kubernetes
token: ${{ secrets.HOME_K8S_TOKEN }}
path: home-kubernetes
- name: Update image tag in home-kubernetes values
run: |
sed -i "s/^ tag: .*/ tag: ${{ steps.meta.outputs.tag }}/" home-kubernetes/helm/csi-driver/values.yaml
- name: Commit and push
run: |
cd home-kubernetes
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add helm/csi-driver/values.yaml
git diff --cached --quiet || git commit -m "chore: update csi-driver image tag to ${{ steps.meta.outputs.tag }}"
git push