Upgrade 0Chain GoSDK to staging #733
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: build-&-publish-minio-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_SERVER_REGISTRY: ${{ secrets.MINIO_SERVER_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 up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20.0 | |
- 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: Install Dependencies | |
run: | | |
sudo apt update -y | |
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget | |
- name: Build & Push Docker Image. | |
id: docker_build | |
run: | | |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8) | |
docker build -t zbox_base -f docker.local/base.Dockerfile . | |
docker build -t $MINIO_SERVER_REGISTRY:latest . | |
docker tag $MINIO_SERVER_REGISTRY:latest $MINIO_SERVER_REGISTRY:$TAG-$SHORT_SHA | |
docker tag $MINIO_SERVER_REGISTRY:latest $MINIO_SERVER_REGISTRY:$TAG | |
docker push $MINIO_SERVER_REGISTRY:$TAG-$SHORT_SHA | |
docker push $MINIO_SERVER_REGISTRY:$TAG | |
- name: Push latest | |
if: ${{ github.event.inputs.latest_tag == 'yes' || github.ref == 'refs/heads/master' }} | |
run: | | |
docker push $MINIO_SERVER_REGISTRY:latest | |
- name: Push staging | |
if: ${{ github.event.inputs.latest_tag == 'yes' || github.ref == 'refs/heads/staging' }} | |
run: | | |
docker tag $MINIO_SERVER_REGISTRY:latest $MINIO_SERVER_REGISTRY:staging | |
docker push $MINIO_SERVER_REGISTRY:staging | |
- name: Clean Up The Workspace. | |
if: ${{ always() }} | |
run: | | |
rm -rf ./* |