Skip to content

Commit

Permalink
add a docker hub action
Browse files Browse the repository at this point in the history
  • Loading branch information
naftis committed Feb 6, 2024
1 parent 8fe849b commit eaf3c16
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish image to Dockerhub

on:
push:
branches:
- master
workflow_dispatch:
inputs:
branch_name:
description: Branch to build from
default: master
required: true
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ github.event.inputs.branch_name }}'
- uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push image
env:
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }}
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }}
run: |
export VERSION=`git rev-parse --short=7 HEAD`
echo "Publishing a Docker image with a tag $VERSION"
docker-compose build && docker-compose push && unset VERSION

0 comments on commit eaf3c16

Please sign in to comment.