Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: github action for docker build push #86

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build-and-push
on:
push:
branches:
- main
- release-*
tags:
- '*'

permissions:
contents: read

jobs:
build-and-push:
runs-on: ubuntu-latest
if: github.repository == 'ceph/ceph-csi-operator'
steps:
- name: Checkout code
uses: actions/checkout@v3

- 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_IO_USERNAME }}
# password: ${{ secrets.QUAY_IO_PASSWORD }}
- name: Set up Image tag
run: |
echo "image tag ${{ github.ref }}"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/heads/* ]]; then
TAG=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')
echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV
fi
- name: print env
run: echo $IMAGE_TAG

- name: Build and push Docker images
run: make docker-buildx IMAGE_TAG=${{ env.IMAGE_TAG }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ go.work.sum

# Locally generated install files
dist/

# Locally generated dockerfile for multi-arch
Dockerfile.cross
Loading