Skip to content

cd-ratel

cd-ratel #8

Workflow file for this run

name: cd-ratel
on:
workflow_dispatch:
inputs:
latest:
type: boolean
default: false
description: If enabled, the image will be tagged and pushed as `latest` on DockerHub.
releasetag:
type: string
required: true
description: The version tag to use for the Docker image (e.g., v24.0.0)
custom-build:
type: boolean
default: false
description: If enabled, image is tagged and pushed with the version only
permissions:
contents: read
env:
BUILD_VERSION: ${{ github.event.inputs.releasetag }}
jobs:
ratel-build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.releasetag }}"
- name: Validate inputs
run: |
if [ "${{ github.event.inputs.custom-build }}" != "true" ] && [ "${{ github.event.inputs.latest }}" != "true" ]; then
echo "Error: You must enable either 'custom-build' or 'latest'"
exit 1
fi
- name: Build Docker Image
run: |
if [ "${{ github.event.inputs.latest }}" = "true" ]; then
echo "Building with 'make latest'"
make latest
else
echo "Building with 'make build'"
make build
fi
- name: Save Docker Image
run: |
IMAGE_LIST="dgraph/ratel:${BUILD_VERSION}"
if [ "${{ github.event.inputs.latest }}" = "true" ]; then
IMAGE_LIST="$IMAGE_LIST dgraph/ratel:latest"
fi
echo "Saving Docker image(s): $IMAGE_LIST"
docker save -o ratel-docker-image.tar $IMAGE_LIST
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: ratel-docker-image
path: ratel-docker-image.tar
ratel-push:
needs: ratel-build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.releasetag }}"
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD_TOKEN }}
- name: Download Docker Image
uses: actions/download-artifact@v4
with:
name: ratel-docker-image
- name: Load Docker Image
run: docker load -i ratel-docker-image.tar
- name: Push Docker Image(s)
run: |
if [ "${{ github.event.inputs.latest }}" = "true" ]; then
echo "Pushing with make release (version + latest)"
make release
else
echo "Pushing version-only image"
make push
fi