Merge pull request #141 from centrifuge/fix/use-latest-transaction-ve… #52
Workflow file for this run
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
# Copyright 2020 ChainSafe Systems | |
# SPDX-License-Identifier: LGPL-3.0-only | |
name: Docker build and push | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*.*.*" | |
jobs: | |
build-and-deploy: | |
name: Docker Deployment | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.ref, '/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=centrifugeio/chainbridge | |
GIT_SHORT_COMMIT=`git rev-parse --short HEAD` | |
TIMESTAMP=`date -u +%Y%m%d%H` | |
VERSION="${TIMESTAMP}-${GIT_SHORT_COMMIT}" | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
fi | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | |
TAGS="$TAGS,${DOCKER_IMAGE}:latest" | |
fi | |
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.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_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 }} |