Skip to content

Build and Release Docker Image #3

Build and Release Docker Image

Build and Release Docker Image #3

Workflow file for this run

name: Build and Release Docker Image
on:
pull_request:
types: [closed]
branches:
- main
workflow_dispatch:
jobs:
build-and-release:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'changelog-update')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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: ${{ vars.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image tags
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/bastion
docker.io/${{ vars.DOCKERHUB_LOGIN }}/bastion
tags: |
type=raw,value=latest
type=raw,value={{ date 'YYYY.MM' }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}