Follow up - 0798e7d47e - moved from circle ci to github actions. Extract REPO_USER to GitHub secret to make it reusable in Zammad Docker Omnibus and Compose repository.

This commit is contained in:
André Bauer 2020-03-06 13:10:59 +01:00 committed by Thorsten Eckel
parent 231a7aaf65
commit 584680e7e4
3 changed files with 6 additions and 5 deletions

View file

@ -7,7 +7,6 @@ set -o pipefail
DOCKER_REGISTRY="index.docker.io" DOCKER_REGISTRY="index.docker.io"
REPO_ROOT="$(git rev-parse --show-toplevel)" REPO_ROOT="$(git rev-parse --show-toplevel)"
REPO_USER="zammad"
ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')" ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')"
# dockerhub auth # dockerhub auth
@ -21,7 +20,7 @@ cd "${REPO_ROOT}/${DOCKER_GITHUB_REPOSITORY}"
# shellcheck disable=SC2153 # shellcheck disable=SC2153
for DOCKER_IMAGE in ${DOCKER_IMAGES}; do for DOCKER_IMAGE in ${DOCKER_IMAGES}; do
echo "Build Zammad Docker image ${DOCKER_IMAGE} with version ${ZAMMAD_VERSION} for DockerHubs ${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE} repo" echo "Build Zammad Docker image ${DOCKER_IMAGE} with version ${ZAMMAD_VERSION} for DockerHubs ${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY} repo"
if [ "${DOCKER_REPOSITORY}" == "zammad-docker-compose" ]; then if [ "${DOCKER_REPOSITORY}" == "zammad-docker-compose" ]; then
docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}" -t "${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-latest" -t "${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${ZAMMAD_VERSION}" -f "containers/${DOCKER_IMAGE}/Dockerfile" . docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}" -t "${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-latest" -t "${DOCKER_REGISTRY}/${REPO_USER}/${DOCKER_REPOSITORY}:${DOCKER_IMAGE}-${ZAMMAD_VERSION}" -f "containers/${DOCKER_IMAGE}/Dockerfile" .

View file

@ -2,17 +2,18 @@ name: build-docker-compose-images
on: on:
push: push:
branches: [stable] branches: [stable**]
jobs: jobs:
build-docker-compose-images: build-docker-compose-images:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
DOCKER_GITHUB_REPOSITORY: "zammad-docker-compose"
DOCKER_IMAGES: "zammad zammad-elasticsearch zammad-postgresql" DOCKER_IMAGES: "zammad zammad-elasticsearch zammad-postgresql"
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REPOSITORY: "zammad-docker-compose" DOCKER_REPOSITORY: "zammad-docker-compose"
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_GITHUB_REPOSITORY: "zammad-docker-compose" REPO_USER: ${{ secrets.REPO_USER }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@master uses: actions/checkout@master

View file

@ -8,11 +8,12 @@ jobs:
build-docker-image: build-docker-image:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
DOCKER_GITHUB_REPOSITORY: "zammad-docker"
DOCKER_IMAGES: "zammad" DOCKER_IMAGES: "zammad"
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REPOSITORY: "zammad" DOCKER_REPOSITORY: "zammad"
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_GITHUB_REPOSITORY: "zammad-docker" REPO_USER: ${{ secrets.REPO_USER }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@master uses: actions/checkout@master