Skip to content

Build and Publish Docker Image #13

Build and Publish Docker Image

Build and Publish Docker Image #13

name: Build and Publish Docker Image
on:
workflow_run:
workflows: ["Build and Upload Artifacts"]
types:
- completed
branches:
- main
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_NAME: mecoblock/sanitizetelebot
jobs:
build-and-push:
# Only run if the Go build workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download Go Artifacts
uses: actions/download-artifact@v4
with:
name: sanitizetelebot-linux-*
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
path: bin
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_NAME }}:latest
build-args: |
APP_BINARY=sanitizetelebot-linux-${TARGETARCH}