cd-dgraph #54
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: cd-dgraph | |
on: | |
workflow_dispatch: | |
inputs: | |
latest: | |
type: boolean | |
default: false | |
description: release latest tag docker-images on dockerhub | |
releasetag: | |
description: releasetag | |
required: true | |
type: string | |
custom-build: | |
type: boolean | |
default: false | |
description: if checked, images will be pushed to dgraph-custom repo in Dockerhub | |
jobs: | |
dgraph-build-amd64: | |
runs-on: warp-ubuntu-latest-x64-16x | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.inputs.releasetag }}' | |
- name: Get Go Version | |
run: | | |
#!/bin/bash | |
GOVERSION=$({ [ -f .go-version ] && cat .go-version; }) | |
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GOVERSION }} | |
- name: Install protobuf-compiler | |
run: sudo apt-get install -y protobuf-compiler | |
- name: Check protobuf | |
run: | | |
cd ./protos | |
go mod tidy | |
make regenerate | |
git diff --exit-code -- . | |
- name: Set Badger Release Version | |
run: | | |
#!/bin/bash | |
BADGER_RELEASE_VERSION=$(cat go.mod | grep -i "github.com/dgraph-io/badger" | awk '{print $2}') | |
echo "setting badger version "$BADGER_RELEASE_VERSION | |
echo "BADGER_RELEASE_VERSION=$BADGER_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Download Badger Artifacts | |
run: | | |
#!/bin/bash | |
mkdir badger | |
cd badger | |
wget https://github.com/dgraph-io/badger/releases/download/${{ env.BADGER_RELEASE_VERSION }}/badger-checksum-linux-amd64.sha256 | |
wget https://github.com/dgraph-io/badger/releases/download/${{ env.BADGER_RELEASE_VERSION }}/badger-linux-amd64.tar.gz | |
- name: Set Dgraph Release Version | |
run: | | |
#!/bin/bash | |
GIT_TAG_NAME='${{ github.event.inputs.releasetag }}' | |
if [[ "$GIT_TAG_NAME" == "v"* ]]; | |
then | |
echo "this is a release branch" | |
else | |
echo "this is NOT a release branch" | |
exit 1 | |
fi | |
DGRAPH_RELEASE_VERSION='${{ github.event.inputs.releasetag }}' | |
echo "making a new release for dgraph "$DGRAPH_RELEASE_VERSION | |
echo "DGRAPH_RELEASE_VERSION=$DGRAPH_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Make Dgraph Linux Build | |
run: make dgraph DGRAPH_VERSION=${{ env.DGRAPH_RELEASE_VERSION }} | |
- name: Generate SHA for Dgraph Linux Build | |
run: cd dgraph && sha256sum dgraph | cut -c-64 > dgraph-checksum-linux-amd64.sha256 | |
- name: Tar Archive for Dgraph Linux Build | |
run: cd dgraph && tar -zcvf dgraph-linux-amd64.tar.gz dgraph | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
badger/badger-checksum-linux-amd64.sha256 | |
badger/badger-linux-amd64.tar.gz | |
dgraph/dgraph-checksum-linux-amd64.sha256 | |
dgraph/dgraph-linux-amd64.tar.gz | |
- name: Move Badger Binary into Linux Directory | |
run: | | |
tar -xzf badger/badger-linux-amd64.tar.gz --directory badger | |
[ -d "linux" ] || mkdir linux | |
# linux directory will be added to docker image in build step | |
cp badger/badger-linux-amd64 linux/badger | |
- name: Make Dgraph Docker Image | |
run: | | |
make docker-image DGRAPH_VERSION=${{ env.DGRAPH_RELEASE_VERSION }}-amd64 | |
[[ "${{ inputs.latest }}" = true ]] && docker tag dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 dgraph/dgraph:latest-amd64 || true | |
[[ "${{ inputs.custom-build }}" = true ]] && docker tag dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 || true | |
- name: Make Dgraph Standalone Docker Image with Version | |
#No need to build and push Standalone Image when its a custom build | |
if: inputs.custom-build == false | |
run: | | |
make docker-image-standalone DGRAPH_VERSION=${{ env.DGRAPH_RELEASE_VERSION }}-amd64 | |
[[ "${{ inputs.latest }}" = true ]] && docker tag dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 dgraph/standalone:latest-amd64 || true | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD_TOKEN }} | |
- name: Push Images to DockerHub | |
run: | | |
if [ "${{ inputs.custom-build }}" == "true" ]; then | |
docker push dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 | |
else | |
docker push dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 | |
docker push dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 | |
fi | |
dgraph-build-arm64: | |
runs-on: warp-ubuntu-latest-arm64-16x | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.inputs.releasetag }}' | |
- name: Get Go Version | |
run: | | |
#!/bin/bash | |
GOVERSION=$({ [ -f .go-version ] && cat .go-version; }) | |
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GOVERSION }} | |
- name: Install protobuf-compiler | |
run: sudo apt-get install -y protobuf-compiler | |
- name: Check protobuf | |
run: | | |
cd ./protos | |
go mod tidy | |
make regenerate | |
git diff --exit-code -- . | |
- name: Set Badger Release Version | |
run: | | |
#!/bin/bash | |
BADGER_RELEASE_VERSION=$(cat go.mod | grep -i "github.com/dgraph-io/badger" | awk '{print $2}') | |
echo "setting badger version "$BADGER_RELEASE_VERSION | |
echo "BADGER_RELEASE_VERSION=$BADGER_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Download Badger Artifacts | |
run: | | |
#!/bin/bash | |
mkdir badger | |
cd badger | |
wget https://github.com/dgraph-io/badger/releases/download/${{ env.BADGER_RELEASE_VERSION }}/badger-checksum-linux-arm64.sha256 | |
wget https://github.com/dgraph-io/badger/releases/download/${{ env.BADGER_RELEASE_VERSION }}/badger-linux-arm64.tar.gz | |
- name: Set Dgraph Release Version | |
run: | | |
#!/bin/bash | |
GIT_TAG_NAME='${{ github.event.inputs.releasetag }}' | |
if [[ "$GIT_TAG_NAME" == "v"* ]]; | |
then | |
echo "this is a release branch" | |
else | |
echo "this is NOT a release branch" | |
exit 1 | |
fi | |
DGRAPH_RELEASE_VERSION='${{ github.event.inputs.releasetag }}' | |
echo "making a new release for dgraph "$DGRAPH_RELEASE_VERSION | |
echo "DGRAPH_RELEASE_VERSION=$DGRAPH_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Make Dgraph Linux Build | |
run: make dgraph DGRAPH_VERSION=${{ env.DGRAPH_RELEASE_VERSION }} | |
- name: Generate SHA for Dgraph Linux Build | |
run: cd dgraph && sha256sum dgraph | cut -c-64 > dgraph-checksum-linux-arm64.sha256 | |
- name: Tar Archive for Dgraph Linux Build | |
run: cd dgraph && tar -zcvf dgraph-linux-arm64.tar.gz dgraph | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
badger/badger-checksum-linux-arm64.sha256 | |
badger/badger-linux-arm64.tar.gz | |
dgraph/dgraph-checksum-linux-arm64.sha256 | |
dgraph/dgraph-linux-arm64.tar.gz | |
- name: Move Badger Binary into Linux Directory | |
run: | | |
tar -xzf badger/badger-linux-arm64.tar.gz --directory badger | |
[ -d "linux" ] || mkdir linux | |
# linux directory will be added to docker image in build step | |
cp badger/badger-linux-arm64 linux/badger | |
- name: Make Dgraph Docker Image | |
run: | | |
make docker-image DGRAPH_VERSION=${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
[[ "${{ inputs.latest }}" = true ]] && docker tag dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 dgraph/dgraph:latest-arm64 || true | |
[[ "${{ inputs.custom-build }}" = true ]] && docker tag dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 || true | |
- name: Make Dgraph Standalone Docker Image with Version | |
#No need to build and push Standalone Image when its a custom build | |
if: inputs.custom-build == false | |
run: | | |
make docker-image-standalone DGRAPH_VERSION=${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
[[ "${{ inputs.latest }}" = true ]] && docker tag dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 dgraph/standalone:latest-arm64 || true | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD_TOKEN }} | |
- name: Push Images to DockerHub | |
run: | | |
if [ "${{ inputs.custom-build }}" == "true" ]; then | |
docker push dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
else | |
docker push dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
docker push dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
fi | |
dgraph-docker-manifest: | |
needs: [dgraph-build-amd64, dgraph-build-arm64] | |
runs-on: warp-ubuntu-latest-x64-16x | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.inputs.releasetag }}' | |
- name: Set Dgraph Release Version | |
run: | | |
#!/bin/bash | |
GIT_TAG_NAME='${{ github.event.inputs.releasetag }}' | |
if [[ "$GIT_TAG_NAME" == "v"* ]]; | |
then | |
echo "this is a release branch" | |
else | |
echo "this is NOT a release branch" | |
exit 1 | |
fi | |
DGRAPH_RELEASE_VERSION='${{ github.event.inputs.releasetag }}' | |
echo "making a new release for dgraph "$DGRAPH_RELEASE_VERSION | |
echo "DGRAPH_RELEASE_VERSION=$DGRAPH_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD_TOKEN }} | |
- name: Docker Manifest | |
run: | | |
if [ "${{ github.event.inputs.custom-build }}" == "true" ]; then | |
docker manifest create dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }} --amend dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 --amend dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
docker manifest push dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }} | |
else | |
# standalone | |
docker manifest create dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }} --amend dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 --amend dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
docker manifest push dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }} | |
if [ "${{ github.event.inputs.latest }}" == "true" ]; then | |
docker manifest create dgraph/standalone:latest --amend dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 --amend dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
docker manifest push dgraph/standalone:latest | |
fi | |
# dgraph | |
docker manifest create dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }} --amend dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 --amend dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
docker manifest push dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }} | |
if [ "${{ github.event.inputs.latest }}" == "true" ]; then | |
docker manifest create dgraph/dgraph:latest --amend dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 --amend dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 | |
docker manifest push dgraph/dgraph:latest | |
fi | |
fi | |