Skip to content

Publish Release

Publish Release #7

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 job updates the kubegres.yaml with the new version is going to be released, and creates a commit and a tag with the changes
update-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: Commit and push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: "pre-release-tag: Update kubegres.yaml to version ${{ github.event.inputs.version }}"
branch: ${{ github.event.inputs.branch }}
rebase: true
- name: recover new git commit sha
id: get-commit-sha
run: echo "NEW_SHA=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" && echo "$GITHUB_OUTPUT"
- 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: '${{ steps.get-commit-sha.outputs.NEW_SHA }}'
})
# this job builds the docker image and pushes it to docker hub
docker-hub-push:
needs: update-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