Skip to content

Commit

Permalink
Have GH Actions workflow to publish Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceaulinic committed Nov 8, 2022
1 parent 2a0adae commit 06f812e
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
push:
tags:
- '.*'
workflow_run:
workflows: ["Test code"]
branches: [master, develop]
types:
- completed

name: Docker Build
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Extract tag name
id: extract_tag_name
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})"

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: napalmautomation/napalm-logs:${{ steps.extract_tag_name.outputs.tag }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 06f812e

Please sign in to comment.