Skip to content

Publish Release

Publish Release #13

name: Publish Release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release in the format v0.0.0-tetrate-v0'
required: true
branch:
description: 'Branch to release from. Like release-v0.0.0'
required: true
env:
GOPROXY: https://proxy.golang.org
jobs:
# This checks if the kubegres.yaml is up to date.
# We cannot make the action to update the kubegres.yaml because the release-* branches are protected,
# and the action would not have the permissions to push the changes.
check-kubegres-yaml:
runs-on: ubuntu-latest
env:
IMG: tetrate/kubegres:${{ github.event.inputs.version }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Update kubegres.yaml
run: make deploy
- name: Check if there are changes
run: |
git diff --exit-code
if [ $? -ne 0 ]; then
echo "kubegres.yaml is not up to date. Run `IMG=${IMG} make deploy` to update it."
exit 1
fi
- name: Create the tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.version }}',
sha: context.sha
})
# this job builds the docker image and pushes it to docker hub
docker-hub-push:
needs: check-kubegres-yaml
runs-on: ubuntu-latest
env:
IMG: tetrate/kubegres:${{ github.event.inputs.version }}
PLATFORMS: linux/amd64,linux/arm64
steps:
- uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- uses: docker/setup-buildx-action@v3
id: setup-buildx
with:
platforms: ${{ env.PLATFORMS }}
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- env:
DOCKER_BUILDER_NAME: ${{ steps.setup-buildx.outputs.name }}
run: make docker-build-push