Merge pull request #61 from ghrcdaac/mlh0079-version-440-string #84
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
name: Push To Docker hub | |
on: | |
pull_request: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
- name: Get tag name | |
id: tag-name | |
run: | | |
if [ ${{ contains(github.ref, 'tags') }} = true ]; then | |
echo "Getting name for tag action..." | |
echo "tag_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
else | |
echo "Getting name for action..." | |
echo "tag_name=coverage" >> $GITHUB_OUTPUT | |
fi | |
- 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.tag_name }} | |
- name: Extract coverage report | |
run: | | |
mkdir coverage | |
CID=$(docker create ghrcdaac/dmrpp-generator:${{ steps.tag-name.outputs.tag_name }}) | |
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 }} | |