Skip to content

Add new REGIONZONE Type into calllog #789

Add new REGIONZONE Type into calllog

Add new REGIONZONE Type into calllog #789

# This workflow will build the container image and publish it to container registries.
name: Publish multi-arch container images
# When its time to do a release do a full cross platform build for all supported
# architectures and push all of them to Docker Hub and GitHub Container Registry (GHCR).
# Only trigger on semver shaped tags.
on:
# "Build and publish" on merged
# Actually, there's no "merged" event.
# A "push" event is occurred after the pull request "close" event with "merged" true condition.
# The "push" event could replace "merged" event.
push:
branches:
- master
tags:
- "v*.*.*"
paths-ignore:
- '**.md'
- '.all-contributorsrc'
- '.gitignore'
- 'LICENSE'
- 'CODEOWNERS'
jobs:
# The job key is "publishing"
publishing:
# Job name is "Publishing"
name: Publishing
# This job runs on Ubuntu-latest
# This job runs on Ubuntu-latest (Ubuntu 20.04 LTS checked on 2022-09-06)
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Prepare tags
id: prep
env:
# TODO: Change variable to your repository name and image name.
DOCKER_REPO: cloudbaristaorg
IMAGE_NAME: cb-spider
run: |
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
fi
DOCKER_IMAGE=$DOCKER_REPO/$IMAGE_NAME
DOCKER_TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*$ ]]; then
DOCKER_TAGS="$DOCKER_TAGS,${DOCKER_IMAGE}:latest"
fi
echo "docker-tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT
echo ${DOCKER_TAGS}
GHCR_IMAGE=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
GHCR_TAGS="${GHCR_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*$ ]]; then
GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:latest"
fi
echo "ghcr-tags=${GHCR_TAGS}" >> $GITHUB_OUTPUT
echo ${GHCR_TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2.1.4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT`
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and publish
id: docker_build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./
file: ./Dockerfile
target: prod
platforms: linux/amd64 # linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x,linux/arm/v6
push: true
tags: |
${{ steps.prep.outputs.docker-tags }}
${{ steps.prep.outputs.ghcr-tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}