Skip to content

build

build #2118

Workflow file for this run

---
name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: hadolint/hadolint-action@2332a7b74a6de0dda2e2221d575162eba76ba5e5 # v3.3.0
with:
dockerfile: Dockerfile
grab-imapfilter-latest:
needs: lint
runs-on: ubuntu-latest
steps:
- id: imapfilter-latest-tag
run: |
# Can't find an endpoint that returns the latest tag - only
# the latest release. And since lefcha doesn't use GitHub's
# release feature the tags must be used.
tag="$(curl --location --silent https://api.github.com/repos/lefcha/imapfilter/tags | jq -r '.[].name' | head -1)"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
outputs:
tag: ${{ steps.imapfilter-latest-tag.outputs.tag }}
build:
needs: grab-imapfilter-latest
runs-on: ubuntu-latest
strategy:
matrix:
include:
- flavor: |
latest=false
suffix=
args:
imapfilter_spec=master
- flavor: |
latest=false
suffix=-tag
args: |
imapfilter_spec=${{ needs.grab-imapfilter-latest.outputs.tag }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
with:
# Spurious segfaults when compiling
# https://github.com/docker/setup-qemu-action/issues/188
image: tonistiigi/binfmt:qemu-v8.1.5
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
- uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
id: meta
with:
flavor: ${{ matrix.flavor }}
images: |
name=ntnn/imapfilter,enable=${{ github.repository == 'ntnn/docker-imapfilter' && github.ref == 'refs/heads/main' }}
name=ghcr.io/${{ github.repository }},enable=true
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
if: ${{ github.repository == 'ntnn/docker-imapfilter' && github.ref == 'refs/heads/main' }}
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
tags: ${{ steps.meta.outputs.tags }}
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: ${{ matrix.args }}
- uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5
if: ${{ github.repository == 'ntnn/docker-imapfilter' && github.ref == 'refs/heads/main' }}
with:
repository: ntnn/imapfilter
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}