Skip to content

add push to docker hub #15

add push to docker hub

add push to docker hub #15

name: build-on-commit
on:
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
env:
PLATFORM: linux/arm/v7,linux/arm64
permissions:
packages: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Build tags
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
-
name: Set up QEMU need for cross-platform building
uses: docker/setup-qemu-action@v2
-
name: Set up for "docker buildx"
uses: docker/setup-buildx-action@v2
-
name: Login to GitHub's container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build image and push image to ghcr.io and Docker Hub
uses: docker/build-push-action@v4
with:
context: .
push: true
sbom: false
provenance: false
platforms: ${{ env.PLATFORM }}
tags: |
ghcr.io/${{ github.repository }}:latest
ammo74/serial2http:latest
build-args: |
GHCR_REPO=${{ github.repository }}
GHCR_TAG=${{ steps.meta.outputs.tags }}
GHCR_PLATFORMS=${{ env.PLATFORMS }}
-
name: Add README to Docker Hub
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ammo74/serial2http
short-description: "RouterOS container that proxies serial port via HTTP and TCP"