Skip to content

Merge pull request #6 from aosus/copilot/fix-5 #28

Merge pull request #6 from aosus/copilot/fix-5

Merge pull request #6 from aosus/copilot/fix-5 #28

name: Docker Build and Publish
on:
push:
branches:
- master # Or your default branch, e.g., master
- feat/matrix-bot-configurable-paths
pull_request:
branches:
- master # Or your default branch
workflow_dispatch:
jobs:
build-and-push-image:
# Only run this job on pushes to the main branch
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # Needed to push to GHCR
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
tags: |
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
tags: ghcr.io/aosus/matrix-privacy-link-bot:latest
platforms: linux/amd64, linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max