Skip to content

Commit

Permalink
Add Github Action to build and push to Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Oct 16, 2021
1 parent f613817 commit 036bbda
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and push to DockerHub
on: [ push, pull_request ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Inject slug/short environment variables
uses: rlespinasse/github-slug-action@v3.x
- name: Decide whether to push to DockerHub, and set tag
if: |
github.event_name == 'push' &&
( startsWith( env.GITHUB_REF, 'refs/tags/' ) ||
contains( fromJSON('["master","develop","testnet","hardfork"]'), env.GITHUB_REF_NAME ) )
run: |
echo "DOCKER_PUSH_TAG=${GITHUB_REF_NAME}"
echo "DOCKER_PUSH_TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: Test tag
if: env.DOCKER_PUSH_TAG != ''
run: echo "${DOCKER_PUSH_TAG}"
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build only
uses: docker/build-push-action@v2
with:
context: .
load: true
- name: Login to DockerHub
if: env.DOCKER_PUSH_TAG != ''
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to DockerHub
if: env.DOCKER_PUSH_TAG != ''
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: bitshares/bitshares-core:${{ env.DOCKER_PUSH_TAG }}

0 comments on commit 036bbda

Please sign in to comment.