Skip to content

Prepare building and publishing nightly to DockerHub #615

Prepare building and publishing nightly to DockerHub

Prepare building and publishing nightly to DockerHub #615

name: Prepare building and publishing nightly to DockerHub
on:
workflow_dispatch:
schedule:
- cron: '24 3 * * *'
jobs:
check-commit-dates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: check-commit-dates
run: |
if [ -z "$(git log --since='24 hours ago')" ]; then
SHOULD_RUN="false"
else
SHOULD_RUN="true"
fi
echo "should-run=${SHOULD_RUN}" >> $GITHUB_OUTPUT
outputs:
should-run: ${{ steps.check-commit-dates.outputs.should-run }}
nightly-prepare-version-info:
needs: check-commit-dates
if: ${{ needs.check-commit-dates.outputs.should-run }}
runs-on: ubuntu-latest
steps:
- name: Get git
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Create docker tags
id: prep
run: |
DOCKER_IMAGE=budgeteerorg/budgeteer
VERSION=$(git describe --tags)
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:nightly"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "sha=${GITHUB_SHA}" >> $GITHUB_OUTPUT
outputs:
tags: ${{ steps.prep.outputs.tags }}
sha: ${{ steps.prep.outputs.sha }}
nightly-call-build-and-publish:
needs: nightly-prepare-version-info
uses: adessoAG/budgeteer/.github/workflows/build-publish-docker.yaml@main
with:
tags: ${{ needs.nightly-prepare-version-info.outputs.tags }}
repository: adessoAG/budgeteer
sha: ${{ needs.nightly-prepare-version-info.outputs.sha }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}