Skip to content

- Only push to dockerhub for tags. #46

- Only push to dockerhub for tags.

- Only push to dockerhub for tags. #46

name: Push To Docker hub
on:
push:
tags:
- v*
branches:
- master
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:

Check failure on line 14 in .github/workflows/push-to-dockerhub.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/push-to-dockerhub.yml

Invalid workflow file

You have an error in your yaml syntax on line 14
- name: Test step
- run: |
echo "${{ contains(github.ref, 'tags') }}"
echo "${{ github.ref }}"
- name: Checkout the repo
uses: actions/checkout@v3
- name: Get tag version
id: tag_name
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: contains(github.ref, 'tags')
tags: ghrcdaac/dmrpp-generator:${{ steps.tag_name.outputs.SOURCE_TAG }}
- name: Extract coverage report
run: |
mkdir coverage
CID=$(docker create ghrcdaac/dmrpp-generator:${{ steps.tag_name.outputs.SOURCE_TAG }})
docker cp "${CID}":/home/worker/build/coverage/lcov.info ./coverage
docker rm "${CID}"
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}