Add support for nightly builds
This commit is contained in:
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
@@ -4,6 +4,8 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '*/15 * * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -30,10 +32,30 @@ 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
|
||||
# date -d 'yesterday' +%Y-%m-%dT02:00:0
|
||||
since="$(date -d 'yesterday' +%Y-%m-%d) 02: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: Generate build variables
|
||||
id: prep
|
||||
run: |
|
||||
echo "version=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
|
||||
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
|
||||
fi
|
||||
echo "built_at=$(date +%Y-%m-%dT%H:%M:%S)" >> $GITHUB_OUTPUT
|
||||
echo "git_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
@@ -91,7 +113,12 @@ jobs:
|
||||
steps:
|
||||
- name: Set version
|
||||
id: version
|
||||
run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/})"
|
||||
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
|
||||
fi
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
Reference in New Issue
Block a user