Add charts to dockhand-lru-registry repo #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
jobs: | |
docker: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: actions/checkout@v2 | |
- 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@v2 | |
- name: Set up Buildx | |
if: ${{ env.PUBLISH == 'yes' }} | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
- name: Login to Docker HUB | |
if: ${{ env.PUBLISH == 'yes' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
if: ${{ env.PUBLISH == 'yes' }} | |
uses: docker/login-action@v2 | |
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@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
VERSION=${{ env.CI_VERSION }} | |
tags: | | |
boxboat/dockhand-lru-registry:${{ env.CI_VERSION }} | |
ghcr.io/boxboat/dockhand-lru-registry:${{ env.CI_VERSION }} |