Trigger by tag for docker

This commit is contained in:
Ben Adrian Sarmiento
2024-06-24 02:48:49 +02:00
parent 818f35ee6e
commit b628e821e8

View File

@@ -3,9 +3,7 @@ name: Build Docker Image
on:
push:
tags:
- 'v**'
schedule:
- cron: '40 0 * * *'
- '*'
jobs:
build-and-push-image:
@@ -19,28 +17,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Check for new commits (nightly only)
id: check
if: github.event_name == 'schedule'
continue-on-error: false
run: |
# 3AM CET
since="$(date -d 'yesterday' +%Y-%m-%d) 01:00:00"
count=$(git rev-list --count --since="$since" --until=now HEAD)
if [ "$count" -gt 0 ]; then
echo "new_commits=true" >> $GITHUB_OUTPUT
else
echo "no new commits found for nightly build"
exit 1
fi
- name: Set version
id: buildvars
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "version=$(date +'%Y.%m.%d-nightly')" >> $GITHUB_OUTPUT
else
echo "version=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
echo "version=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
fi
echo "built_at=$(date +%Y-%m-%dT%H:%M:%S)" >> $GITHUB_OUTPUT
echo "git_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT