mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Add nightly for docker CI
This commit is contained in:
parent
84204b8cd5
commit
b1ffbe561e
31
.github/workflows/publish-docker-images.yml
vendored
31
.github/workflows/publish-docker-images.yml
vendored
@ -1,7 +1,5 @@
|
|||||||
---
|
---
|
||||||
on:
|
on:
|
||||||
schedule:
|
|
||||||
- cron: '0 4 * * *' # Every day at 4:00am
|
|
||||||
push:
|
push:
|
||||||
# Will run for every tag pushed except `latest`
|
# Will run for every tag pushed except `latest`
|
||||||
# When the `latest` git tag is created with this [CI](../latest-git-tag.yml)
|
# When the `latest` git tag is created with this [CI](../latest-git-tag.yml)
|
||||||
@ -9,6 +7,10 @@ on:
|
|||||||
# The `latest` Docker image push is already done in this CI when releasing a stable version of Meilisearch.
|
# The `latest` Docker image push is already done in this CI when releasing a stable version of Meilisearch.
|
||||||
tags-ignore:
|
tags-ignore:
|
||||||
- latest
|
- latest
|
||||||
|
# Both `schedule` and `workflow_dispatch` build the nightly tag
|
||||||
|
schedule:
|
||||||
|
- cron: '0 23 * * *' # Every day at 11:00pm
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
name: Publish tagged images to Docker Hub
|
name: Publish tagged images to Docker Hub
|
||||||
|
|
||||||
@ -18,25 +20,28 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
# Check if the tag has the v<nmumber>.<number>.<number> format. If yes, it means we are publishing an official release.
|
# If we are running a cron or manual job ('schedule' or 'workflow_dispatch' event), it means we are publishing the `nightly` tag, so not considered stable.
|
||||||
|
# If we have pushed a tag, and the tag has the v<nmumber>.<number>.<number> format, it means we are publishing an official release, so considered stable.
|
||||||
# In this situation, we need to set `output.stable` to create/update the following tags (additionally to the `vX.Y.Z` Docker tag):
|
# In this situation, we need to set `output.stable` to create/update the following tags (additionally to the `vX.Y.Z` Docker tag):
|
||||||
# - a `vX.Y` (without patch version) Docker tag
|
# - a `vX.Y` (without patch version) Docker tag
|
||||||
# - a `latest` Docker tag
|
# - a `latest` Docker tag
|
||||||
- name: Check tag format
|
# For any other tag pushed, this is not considered stable.
|
||||||
if: github.event_name != 'schedule'
|
- name: Define if stable release
|
||||||
id: check-tag-format
|
id: check-tag-format
|
||||||
run: |
|
run: |
|
||||||
escaped_tag=$(printf "%q" ${{ github.ref_name }})
|
escaped_tag=$(printf "%q" ${{ github.ref_name }})
|
||||||
|
|
||||||
if [[ $escaped_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
if [[ ${{ github.event_name }} != 'push' ]]; then
|
||||||
|
echo "stable=false" >> $GITHUB_OUTPUT
|
||||||
|
elif [[ $escaped_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
echo "stable=true" >> $GITHUB_OUTPUT
|
echo "stable=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "stable=false" >> $GITHUB_OUTPUT
|
echo "stable=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check only the validity of the tag for official releases (not for pre-releases or other tags)
|
# Check only the validity of the tag for stable releases (not for pre-releases or other tags)
|
||||||
- name: Check release validity
|
- name: Check release validity
|
||||||
if: github.event_name != 'schedule' && steps.check-tag-format.outputs.stable == 'true'
|
if: steps.check-tag-format.outputs.stable == 'true'
|
||||||
run: bash .github/scripts/check-release.sh
|
run: bash .github/scripts/check-release.sh
|
||||||
|
|
||||||
- name: Set build-args for Docker buildx
|
- name: Set build-args for Docker buildx
|
||||||
@ -54,7 +59,6 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.event_name != 'schedule'
|
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@ -65,11 +69,12 @@ jobs:
|
|||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: getmeili/meilisearch
|
images: getmeili/meilisearch
|
||||||
# The latest and `vX.Y` tags are only pushed for the official Meilisearch releases
|
# Prevent `latest` to be updated for each new tag pushed.
|
||||||
# See https://github.com/docker/metadata-action#latest-tag
|
# We need latest and `vX.Y` tags to only be pushed for the stable Meilisearch releases.
|
||||||
flavor: latest=false
|
flavor: latest=false
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=tag
|
type=ref,event=tag
|
||||||
|
type=raw,value=nightly,enable=${{ github.event_name != 'push' }}
|
||||||
type=semver,pattern=v{{major}}.{{minor}},enable=${{ steps.check-tag-format.outputs.stable == 'true' }}
|
type=semver,pattern=v{{major}}.{{minor}},enable=${{ steps.check-tag-format.outputs.stable == 'true' }}
|
||||||
type=raw,value=latest,enable=${{ steps.check-tag-format.outputs.stable == 'true' }}
|
type=raw,value=latest,enable=${{ steps.check-tag-format.outputs.stable == 'true' }}
|
||||||
|
|
||||||
@ -77,7 +82,6 @@ jobs:
|
|||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
# We do not push tags for the cron jobs, this is only for test purposes
|
# 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 }}
|
||||||
build-args: |
|
build-args: |
|
||||||
@ -86,7 +90,8 @@ jobs:
|
|||||||
|
|
||||||
# /!\ Don't touch this without checking with Cloud team
|
# /!\ Don't touch this without checking with Cloud team
|
||||||
- name: Send CI information to Cloud team
|
- name: Send CI information to Cloud team
|
||||||
if: github.event_name != 'schedule'
|
# Do not send if nightly build (i.e. 'schedule' or 'workflow_dispatch' event)
|
||||||
|
if: github.event_name == 'push'
|
||||||
uses: peter-evans/repository-dispatch@v2
|
uses: peter-evans/repository-dispatch@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
||||||
|
Loading…
Reference in New Issue
Block a user