Skip to content

Docker Hub publish

Docker Hub publish #72

name: Docker Hub publish
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: '42 1 * * *'
push:
branches: [ "develop" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "develop" ]
env:
# github.repository as <account>/<repo>
IMAGE_NAME: denisyuen/dockstore-tool-bamstats
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags, use your Docker Hub username/organization here
images: |
denisyuen/dockstore-tool-bamstats
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
# this is from https://github.com/docker/build-push-action?tab=readme-ov-file#git-context
# grab the docker hub token from https://app.docker.com/accounts/<your username here>/settings/personal-access-tokens
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# lots more documentation at https://docs.docker.com/build/ci/github-actions/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}