Merge pull request #159 from ccb-hms/feature/rocker-base #139
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: Tag, Build, and Push Docker Image with Github Workflow | |
#Set up tagging/building only on tag releases | |
on: | |
push: | |
tags: [ v* ] | |
paths-ignore: | |
- '**/README.md' | |
jobs: | |
build-container: | |
name: Build container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set Tag Output | |
id: vars | |
run: if [[ ${GITHUB_REF#refs/*/} == v* ]]; then echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT; else echo "tag=v" >> $GITHUB_OUTPUT; fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_ACCESS_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- uses: mad9500/actions-find-and-replace-string@2 | |
id: findandreplace | |
with: | |
source: ${{ steps.vars.outputs.tag }} | |
find: 'v' | |
replace: 'version-' | |
- name: Build, Tag, and Push to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Container/Dockerfile | |
push: true | |
tags: hmsccb/nhanes-workbench:latest, hmsccb/nhanes-workbench:${{ steps.findandreplace.outputs.value }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |