Add schedule to the CI

This commit is contained in:
Clémentine Urquizar 2022-06-09 11:50:20 +02:00
parent 39a1dcb32c
commit 4a494ad2fa
No known key found for this signature in database
GPG Key ID: D8E7CC7422E77E1A

View File

@ -1,12 +1,14 @@
--- ---
on: on:
schedule:
- cron: '0 4 * * *' # Every day at 4:00am
push: push:
tags: tags:
- '*' - '*'
release: release:
types: [released] types: [released]
name: Publish tagged image to Docker Hub name: Publish tagged images to Docker Hub
jobs: jobs:
docker: docker:
@ -19,6 +21,7 @@ jobs:
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'schedule'
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
@ -29,7 +32,7 @@ jobs:
uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
with: with:
images: getmeili/meilisearch images: getmeili/meilisearch
# Output 'latest' tag only when 'release' happen, instead of when 'push tag' event happend (default behavior). # The lastest tag is only pushed for the official Meilisearch release
# See https://github.com/docker/metadata-action#latest-tag # See https://github.com/docker/metadata-action#latest-tag
flavor: latest=false flavor: latest=false
tags: | tags: |
@ -40,6 +43,7 @@ jobs:
id: docker_build id: docker_build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
push: true # We do not push tags for the cron jobs, this is only for test purposes
push: ${{ github.event_name != 'schedule' }}
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}