Skip to content

Commit

Permalink
Added Github Workflow to build docker image and publish it
Browse files Browse the repository at this point in the history
  • Loading branch information
tess1o committed Jan 13, 2025
1 parent 84fb744 commit cb90692
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Image CI

on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract GitHub tag # strip "v" from release version so this value can be used as tag for docker image
id: extract_tag
run: |
echo "GIT_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Print GitHub tag
run: |
echo "The value of GIT_TAG is: $GIT_TAG"
if: startsWith(github.ref, 'refs/tags/v')
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
tags: |
tess1o/go-tapo-exporter:latest
tess1o/go-tapo-exporter:${{ env.GIT_TAG || github.sha }}

0 comments on commit cb90692

Please sign in to comment.