Skip to content

feat: update go.mod

feat: update go.mod #1

# Copyright 2020 ChainSafe Systems
# SPDX-License-Identifier: LGPL-3.0-only
name: Docker build and push
on:
push:
branches:
# when main branch receives a push
- crust
# when any of these versions receive a push
tags:
- "v*.*.*"
# when any releases are created
release:
types:
- created
workflow_dispatch:
# list jobs
jobs:
build-and-deploy:
name: Docker Deployment
runs-on: ubuntu-latest
# requires these jobs to run first
# needs: [test, e2e, lint]
# if check not passed, job will be skipped
if: github.ref == 'refs/heads/crust' || contains(github.ref, '/tags/v')
# list steps
steps:
# prepares docker images
- name: Prepare
id: prep
run: |
# creates local variable of chainbridge docker image
DOCKER_IMAGE=crustio/kubo
# creates local variable of commit hash that triggered workflow
COMMIT_HASH=$(echo $GITHUB_SHA | head -c7)
# creates local variable to hold docker images
TAGS="${DOCKER_IMAGE}:${COMMIT_HASH},${DOCKER_IMAGE}:latest"
# check if branch/tag that triggered workflow was from tags
if [[ $GITHUB_REF == refs/tags/* ]]; then
# set version
VERSION=${GITHUB_REF#refs/tags/}
# append version to tags
TAGS="${TAGS},${DOCKER_IMAGE}:${VERSION}"
fi
# sets output of step
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}