-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
Addresses https://github.com/orgs/dgraph-io/discussions/8911
For both Dgraph and dgo, add a step in our CD runner that hits the "golang index" so that the new version is available to the index.golang.org.
diff --git a/.github/workflows/cd-dgraph.yml b/.github/workflows/cd-dgraph.yml
--- a/.github/workflows/cd-dgraph.yml
+++ b/.github/workflows/cd-dgraph.yml
@@ -1,327 +1,335 @@
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
permissions:
contents: read
jobs:
dgraph-build-amd64:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
ref: "${{ github.event.inputs.releasetag }}"
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install protobuf-compiler
run: sudo apt update && sudo apt 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@v4
with:
name: dgraph-amd-release-artifacts
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: |
set -e
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
#Save all tagged images into a single tar file
docker save -o dgraph-docker-amd64.tar \
dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 \
$( [[ "${{ inputs.latest }}" = true ]] && echo "dgraph/dgraph:latest-amd64" ) \
$( [[ "${{ inputs.custom-build }}" = true ]] && echo "dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-amd64" )
- name: Upload AMD64 Docker Image
uses: actions/upload-artifact@v4
with:
name: dgraph-docker-amd64
path: dgraph-docker-amd64.tar
- 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: |
set -e
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
docker save -o dgraph-standalone-amd64.tar \
dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 \
$( [[ "${{ inputs.latest }}" = true ]] && echo "dgraph/standalone:latest-amd64" )
- name: Upload AMD64 Standalone Image
if: inputs.custom-build == false
uses: actions/upload-artifact@v4
with:
name: dgraph-standalone-amd64
path: dgraph-standalone-amd64.tar
dgraph-build-arm64:
runs-on: blacksmith-4vcpu-ubuntu-2404-arm
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
ref: "${{ github.event.inputs.releasetag }}"
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install protobuf-compiler
run: sudo apt update && sudo apt 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@v4
with:
name: dgraph-arm-release-artifacts
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: |
set -e
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
docker save -o dgraph-docker-arm64.tar \
dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 \
$( [[ "${{ inputs.latest }}" = true ]] && echo "dgraph/dgraph:latest-arm64" ) \
$( [[ "${{ inputs.custom-build }}" = true ]] && echo "dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-arm64" )
- name: Upload ARM64 Docker Image
uses: actions/upload-artifact@v4
with:
name: dgraph-docker-arm64
path: dgraph-docker-arm64.tar
- 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: |
set -e
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
docker save -o dgraph-standalone-arm64.tar \
dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64 \
$( [[ "${{ inputs.latest }}" = true ]] && echo "dgraph/standalone:latest-arm64" )
- name: Upload ARM64 Standalone Image
if: inputs.custom-build == false
uses: actions/upload-artifact@v4
with:
name: dgraph-standalone-arm64
path: dgraph-standalone-arm64.tar
graph-docker-image-and-manifests-push:
needs: [dgraph-build-amd64, dgraph-build-arm64]
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
ref: "${{ github.event.inputs.releasetag }}"
+ - name: Set up Go
+ uses: actions/setup-go@v6
+ with:
+ go-version-file: go.mod
- 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@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD_TOKEN }}
# Download AMD64 Tar File
- name: Download Dgraph AMD64 Tar
uses: actions/download-artifact@v5
with:
name: dgraph-docker-amd64
# Download Dgraph ARM64 Tar File
- name: Download ARM64 Tar
uses: actions/download-artifact@v5
with:
name: dgraph-docker-arm64
# Load Dgraph AMD64 Image
- name: Load AMD64 Docker Image
run: |
docker load -i dgraph-docker-amd64.tar
# Load Dgraph ARM64 Image
- name: Load ARM64 Docker Image
run: |
docker load -i dgraph-docker-arm64.tar
# Download Standalone AMD64 Tar File
- name: Download Standalone AMD64 Tar
if: inputs.custom-build == false
uses: actions/download-artifact@v5
with:
name: dgraph-standalone-amd64
# Load Standalone AMD64 Image
- name: Load Standalone AMD64 Docker Image
if: inputs.custom-build == false
run: |
docker load -i dgraph-standalone-amd64.tar
# Download Standalone ARM64 Tar File
- name: Download Standalone ARM64 Tar
if: inputs.custom-build == false
uses: actions/download-artifact@v5
with:
name: dgraph-standalone-arm64
# Load Standalone ARM64 Image
- name: Load Standalone ARM64 Docker Image
if: inputs.custom-build == false
run: |
docker load -i dgraph-standalone-arm64.tar
- name: Docker Manifest
run: |
if [ "${{ github.event.inputs.custom-build }}" == "true" ]; then
#Push AMD and ARM images to dgraph-custom repo
docker push dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-amd64
docker push dgraph/dgraph-custom:${{ env.DGRAPH_RELEASE_VERSION }}-arm64
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
# Push standalone Images and manifest
docker push dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64
docker push dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64
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 }}
# Push Dgraph Images and Manifest
docker push dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-amd64
docker push dgraph/dgraph:${{ env.DGRAPH_RELEASE_VERSION }}-arm64
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/standalone:latest --amend dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-amd64 --amend dgraph/standalone:${{ env.DGRAPH_RELEASE_VERSION }}-arm64
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/standalone:latest
docker manifest push dgraph/dgraph:latest
fi
fi
+
+ - name: Push to Go Index
+ if: inputs.custom-build == false
+ run: go list -m github.com/dgraph-io/dgraph@${{ env.DGRAPH_RELEASE_VERSION }}
Metadata
Metadata
Assignees
Labels
No labels