Skip to content

README.md changes(WIP) #196

README.md changes(WIP)

README.md changes(WIP) #196

name: build-&-publish-minio-logsearchapi-docker-image
# concurrency:
# group: "publish-${{ github.ref }}"
# cancel-in-progress: true
on:
push:
branches: [ master,staging,sprint* ]
tags: [ "v*.*.*" ]
pull_request:
workflow_dispatch:
inputs:
staging_tag:
description: 'type yes for building staging tag'
default: 'no'
required: true
env:
MINIO_LOGSEARCHAPI_REGISTRY: ${{ secrets.MINIO_LOGSEARCHAPI_REGISTRY }}
jobs:
dockerize_minio:
runs-on: [self-hosted, arc-runner]
outputs:
output1: ${{ steps.docker_build.outputs.COMMIT_TAG }}
steps:
- uses: actions/checkout@v1
- name: Set Docker Image Tags.
id: get_info
run: |
if [[ "${{github.ref}}" == refs/pull/* ]]; then
tag=${GITHUB_REF/\/merge/}
echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV
else
echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV
fi
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build & Push Docker Image.
id: docker_build
run: |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
cd logsearchapi
docker build -t $MINIO_LOGSEARCHAPI_REGISTRY:latest .
docker tag $MINIO_LOGSEARCHAPI_REGISTRY:latest $MINIO_LOGSEARCHAPI_REGISTRY:$TAG-$SHORT_SHA
docker push $MINIO_LOGSEARCHAPI_REGISTRY:$TAG-$SHORT_SHA
- name: Push latest
if: ${{ github.event.inputs.latest_tag == 'yes' || github.ref == 'refs/heads/master' }}
run: |
docker push ${{ secrets.MINIO_LOGSEARCHAPI_REGISTRY }}:latest
- name: Push staging
if: ${{ github.event.inputs.latest_tag == 'yes' || github.ref == 'refs/heads/staging' }}
run: |
docker tag $MINIO_LOGSEARCHAPI_REGISTRY:latest $MINIO_LOGSEARCHAPI_REGISTRY:staging
docker push ${{ secrets.MINIO_LOGSEARCHAPI_REGISTRY }}:staging
- name: Clean Up The Workspace.
if: ${{ always() }}
run: |
rm -rf ./*