mirror of
https://github.com/elgohr/Publish-Docker-Github-Action.git
synced 2026-03-12 18:07:12 -04:00
508405533072049050cfbeb96bcaee35cecc6036
Publishes docker containers to Dockerhub
This Action for Docker uses the Git branch as the Docker tag for building and pushing the container to DockerHub. Hereby the master-branch is published as the latest-tag.
Usage
New workflow
name: Publish Docker
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Login to Registry
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
args: myDocker/repository
- name: Logout
run: docker logout
Optional Arguments
Push an additional image, which is tagged with the git sha. When you would like to think about versioning images, this might be useful.
with:
args: myDocker/repository
snapshot: true
Old workflow
workflow "Publish Docker" {
on = "push"
resolves = ["logout"]
}
action "login" {
uses = "actions/docker/login@master"
secrets = ["DOCKER_PASSWORD", "DOCKER_USERNAME"]
}
action "publish" {
uses = "elgohr/Publish-Docker-Github-Action@master"
args = "myDocker/repository"
needs = ["login"]
}
action "logout" {
uses = "actions/docker/cli@master"
args = "logout"
needs = ["publish"]
}
Docker builds
Please see https://github.com/elgohr/Publish-Docker-Github-Action/packages
Argument
You need to provide the desired docker repository to the action.
Languages
Shell
96.8%
Dockerfile
2.9%
Makefile
0.3%