Skip to content

Add charts to dockhand-secrets-operator repo #77

Add charts to dockhand-secrets-operator repo

Add charts to dockhand-secrets-operator repo #77

Workflow file for this run

name: docker
on:
push:
paths:
- '**'
- '!charts/**'
branches:
- master
tags:
- '*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compute Version
id: version
run: |
echo ${GITHUB_REF}
tag=${GITHUB_REF#refs/tags/}
publish="no"
if [ "${tag}" != "${GITHUB_REF}" ]; then
tag=$(echo "${tag}" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
version=${tag}
publish="yes"
fi
branch=${GITHUB_REF#refs/heads/}
if [[ -z "${version}" && "${branch}" != "${GITHUB_REF}" ]]; then
branch=$(echo "${branch}" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
version=${branch}
if [[ ${branch} = "master" ]]; then
publish="yes"
fi
fi
pr=${GITHUB_REF#refs/pull/}
if [[ -z "${version}" && "${pr}" != "${GITHUB_REF}" ]]; then
pr=$(echo "${pr}" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
version=${pr}
fi
if [ -z "${version}" ]; then
echo "Version could not be determined" >&2
exit 1
else
echo CI_VERSION=${version} >> $GITHUB_ENV
echo PUBLISH=${publish} >> $GITHUB_ENV
fi
- name: Set up QEMU
if: ${{ env.PUBLISH == 'yes' }}
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
if: ${{ env.PUBLISH == 'yes' }}
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Login to DockerHub
if: ${{ env.PUBLISH == 'yes' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: ${{ env.PUBLISH == 'yes' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
if: ${{ env.PUBLISH == 'yes' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ env.CI_VERSION }}
tags: |
boxboat/dockhand-secrets-operator:${{ env.CI_VERSION }}
ghcr.io/boxboat/dockhand-secrets-operator:${{ env.CI_VERSION }}