Trigger custom cloudbeaver image build #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger custom cloudbeaver image build | |
on: | |
schedule: | |
- cron: "0 10 * * *" # Everyday at 10 AM UTC | |
workflow_dispatch: | |
env: | |
BASE_IMAGE: dbeaver/cloudbeaver | |
jobs: | |
trigger-build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- ref: master | |
tagSuffix: "" | |
- ref: acceptance | |
tagSuffix: -acc | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.ref }} | |
- name: Update image base for ${{ matrix.ref }} branch | |
run: | | |
latestTag=$(curl -fsSL "https://hub.docker.com/v2/repositories/${{ env.BASE_IMAGE }}/tags/?page_size=1000" | jq -r '.results | .[] | .name' | grep -P '^24\.[0-9]\.[0-9]+$' | head -1) | |
if [ -z "${latestTag}" ]; then | |
echo "Error: Could not get latest tag of ${{ env.BASE_IMAGE }} image! Abort!" | |
exit 1 | |
fi | |
sed -Ei "s|FROM dbeaver/cloudbeaver.*|FROM dbeaver/cloudbeaver:${latestTag}|g" Dockerfile && git add Dockerfile | |
if git diff-index --quiet HEAD; then | |
echo "Nothing to commit!" | |
else | |
git config --global user.email "exo-swf@exoplatform.com" | |
git config --global user.name "exo-swf" | |
git commit -m "Bump cloudbeaver version to ${latestTag}" | |
git tag ${latestTag}${{ matrix.tagSuffix }} -m "Release ${latestTag}${{ matrix.tagSuffix }}" | |
git push origin HEAD ${latestTag}${{ matrix.tagSuffix }} | |
fi |