2019-11-21 11:18:54 +01:00
|
|
|
---
|
|
|
|
on:
|
2022-06-09 11:50:20 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '0 4 * * *' # Every day at 4:00am
|
2019-11-21 11:18:54 +01:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*'
|
2022-06-08 17:17:20 +02:00
|
|
|
release:
|
|
|
|
types: [released]
|
2019-11-21 11:18:54 +01:00
|
|
|
|
2022-06-09 11:50:20 +02:00
|
|
|
name: Publish tagged images to Docker Hub
|
2019-11-21 11:18:54 +01:00
|
|
|
|
|
|
|
jobs:
|
2022-06-08 17:17:20 +02:00
|
|
|
docker:
|
2021-12-21 18:32:29 +01:00
|
|
|
runs-on: docker
|
2019-11-21 11:18:54 +01:00
|
|
|
steps:
|
2021-11-11 15:57:06 +01:00
|
|
|
- name: Set up QEMU
|
2022-06-28 22:21:38 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-11-11 15:57:06 +01:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-06-28 22:21:43 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-11-11 15:57:06 +01:00
|
|
|
|
2021-11-11 19:42:30 +01:00
|
|
|
- name: Login to DockerHub
|
2022-06-09 11:50:20 +02:00
|
|
|
if: github.event_name != 'schedule'
|
2022-07-01 19:06:38 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-11-11 19:42:30 +01:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
2022-06-15 10:45:18 +02:00
|
|
|
- name: Check tag format
|
|
|
|
id: check-tag-format
|
|
|
|
run: |
|
|
|
|
# Escape submitted tag name
|
|
|
|
escaped_tag=$(printf "%q" ${{ github.ref_name }})
|
|
|
|
|
|
|
|
# Check if tag has format v<nmumber>.<number>.<number> and set output.match
|
|
|
|
# to create a vX.Y (without patch version) Docker tag
|
|
|
|
if [[ $escaped_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
echo ::set-output name=match::true
|
|
|
|
else
|
|
|
|
echo ::set-output name=match::false
|
|
|
|
fi
|
|
|
|
|
2021-11-11 15:57:06 +01:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
2022-06-28 22:21:32 +02:00
|
|
|
uses: docker/metadata-action@v4
|
2021-11-11 15:57:06 +01:00
|
|
|
with:
|
2021-11-11 19:42:30 +01:00
|
|
|
images: getmeili/meilisearch
|
2022-06-09 11:50:20 +02:00
|
|
|
# The lastest tag is only pushed for the official Meilisearch release
|
2022-06-08 17:17:20 +02:00
|
|
|
# See https://github.com/docker/metadata-action#latest-tag
|
2021-11-11 15:57:06 +01:00
|
|
|
flavor: latest=false
|
2022-06-08 17:17:20 +02:00
|
|
|
tags: |
|
|
|
|
type=ref,event=tag
|
2022-06-15 10:45:18 +02:00
|
|
|
type=semver,pattern=v{{major}}.{{minor}},enable=${{ steps.check-tag-format.outputs.match }}
|
2022-06-08 17:27:03 +02:00
|
|
|
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
|
2021-11-11 15:57:06 +01:00
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
2022-07-01 19:06:44 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2019-11-21 11:18:54 +01:00
|
|
|
with:
|
2022-06-09 11:50:20 +02:00
|
|
|
# We do not push tags for the cron jobs, this is only for test purposes
|
|
|
|
push: ${{ github.event_name != 'schedule' }}
|
2021-11-11 16:28:30 +01:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-11-11 15:57:06 +01:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|