From faf6e90cec37092f153007e667a997d00d0cd76c Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 15 Apr 2021 13:52:09 +0530 Subject: [PATCH] add github action to push image when release is published added a github action to build and push the docker image to quay when release is published Signed-off-by: Madhu Rajanna --- .github/workflows/docker-publish.yaml | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/docker-publish.yaml diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml new file mode 100644 index 00000000..8aa65dab --- /dev/null +++ b/.github/workflows/docker-publish.yaml @@ -0,0 +1,48 @@ +name: Publish Docker image +on: + push: + tags: + - 'v*' + +jobs: + push: + name: Push Image + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + go: ["1.15"] + steps: + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Login to Quay + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + - name: copy volume-replication-operator repo in go src + run: | + mkdir -p /home/runner/go/src/github.com/csi-addons + cp -r /home/runner/work/volume-replication-operator/volume-replication-operator /home/runner/go/src/github.com/csi-addons + + - name: run docker-push + working-directory: "/home/runner/go/src/github.com/csi-addons/volume-replication-operator" + env: + GOPATH: /home/runner/go + run: | + export PATH=$PATH:$GOPATH/bin + export VERSION="2.3.2" + wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v"$VERSION"/kubebuilder_"$VERSION"_linux_amd64.tar.gz + tar -zxvf kubebuilder_"$VERSION"_linux_amd64.tar.gz + export KUBEBUILDER_ASSETS="$(pwd)/kubebuilder_"$VERSION"_linux_amd64/bin" + # build and push image with released tag + IMG_TAG=${{ github.ref }} make docker-build + IMG_TAG=${{ github.ref }} make docker-push