Skip to content

Commit 06f812e

Browse files
committed
Have GH Actions workflow to publish Docker image
1 parent 2a0adae commit 06f812e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
push:
3+
tags:
4+
- '.*'
5+
workflow_run:
6+
workflows: ["Test code"]
7+
branches: [master, develop]
8+
types:
9+
- completed
10+
11+
name: Docker Build
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check Out Repo
18+
uses: actions/checkout@v2
19+
20+
- name: Login to Docker Hub
21+
uses: docker/login-action@v1
22+
with:
23+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
24+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
25+
26+
- name: Set up Docker Buildx
27+
id: buildx
28+
uses: docker/setup-buildx-action@v1
29+
30+
- name: Extract tag name
31+
id: extract_tag_name
32+
shell: bash
33+
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})"
34+
35+
- name: Build and push
36+
id: docker_build
37+
uses: docker/build-push-action@v2
38+
with:
39+
context: ./
40+
file: ./Dockerfile
41+
push: true
42+
tags: napalmautomation/napalm-logs:${{ steps.extract_tag_name.outputs.tag }}
43+
44+
- name: Image digest
45+
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)