Skip to content

Build and upload CSI driver container image #1

Build and upload CSI driver container image

Build and upload CSI driver container image #1

name: Build and upload CSI driver container image
on:
workflow_dispatch:
inputs:
versionTag:
description: "Version tag of the image"
default: ""
type: string
required: false
push:
branches:
- main
jobs:
build-csi-driver:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a
with:
go-version: "1.18"
- name: Pseudo version
id: pseudo-version
run: |
git clone https://github.com/edgelesssys/constellation /constellation
cd /constellation/hack/pseudo-version
echo "pseudoVersion=$(go run .)" >> $GITHUB_ENV
echo ${{ env.pseudoVersion }}
- name: Set up Docker Buildx
id: docker-setup
uses: docker/setup-buildx-action@f211e3e9ded2d9377c8cadc4489a4e38014bc4c9
- name: Build container image
run: make REGISTRY=ghcr.io/edgelesssys VERSION=${{ env.pseudoVersion }} image-csi-plugin
- name: Log in to the Container registry
id: docker-login
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push container image
run: |
docker push ghcr.io/edgelesssys/cinder-csi-plugin:${{ env.pseudoVersion }}
if [ "${{ inputs.versionTag }}" != "" ]
then
docker tag ghcr.io/edgelesssys/constellation/cinder-csi-plugin:${{ env.pseudoVersion }} ghcr.io/edgelesssys/constellation/cinder-csi-plugin:${{ inputs.versionTag }}
docker push ghcr.io/edgelesssys/constellation/cinder-csi-plugin:${{ inputs.versionTag }}
fi