Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions .github/workflows/cd-ratel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
latest:
type: boolean
default: false
description: If enabled, the image will also be tagged and pushed as `latest` on DockerHub.
description: If enabled, the image will be tagged and pushed as `latest` on DockerHub.
releasetag:
type: string
description: The version tag to use for the Docker image (e.g., v21.12.0).
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, images will be tagged with the version tag instead of `latest`
description: If enabled, image is tagged and pushed with the version only

permissions:
contents: read
Expand All @@ -30,18 +30,33 @@ jobs:
- 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: |
echo "Building ratel with version ${BUILD_VERSION}"
make build
if [ "${{ github.event.inputs.latest }}" = "true" ]; then
echo "Building with 'make latest'"
make latest
else
echo "Building with 'make build'"
make build
fi
if [ "${{ github.event.inputs.custom-build }}" = "true" ]; then
docker tag dgraph/ratel:${BUILD_VERSION} dgraph/ratel-custom:${BUILD_VERSION}
fi

- name: Save Docker Image
run: docker save -o ratel-docker-image.tar dgraph/ratel:${BUILD_VERSION}
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:
Expand All @@ -56,24 +71,27 @@ jobs:
- 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 Images

- name: Push Docker Image(s)
run: |
echo "Pushing Docker images with version ${BUILD_VERSION}"
docker push dgraph/ratel:${BUILD_VERSION}
if [ "${{ github.event.inputs.latest }}" = "true" ]; then
docker push dgraph/ratel:latest
fi
if [ "${{ github.event.inputs.custom-build }}" = "true" ]; then
docker push dgraph/ratel-custom:${BUILD_VERSION}
echo "Pushing with make release (version + latest)"
make release
else
echo "Pushing version-only image"
make push
fi