Skip to content

v1.0.0

v1.0.0 #1

Workflow file for this run

name: Create a new release
env:
PROJECT: "cli"
PROJECT_SHORT: "cli"
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: "Tag for the Docker image"
required: true
default: "test"
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Setup Golang for us in the workflow
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
cache-dependency-path: |
go.sum
# Test the Golang application
- name: Test Golang application
run: |
git config --global url."https://${{ secrets.USERNAME }}:${{ secrets.TOKEN }}@github.com/".insteadOf "https://github.com/"
go fmt $(go list ./... | grep -v /vendor/)
go vet $(go list ./... | grep -v /vendor/)
go test -race $(go list ./... | grep -v /vendor/)
# Build the Golang application to the dist folder
- name: Build Golang application
run: |
git config --global url."https://${{ secrets.USERNAME }}:${{ secrets.TOKEN }}@github.com/".insteadOf "https://github.com/"
go build -o main
# Build the Docker image with the latest tag and the release tag
- name: Build and push Docker image with latest tag
uses: docker/build-push-action@v2
if: github.event.inputs.tag != 'test'
with:
context: .
push: true
build-args: |
github_username=${{ secrets.USERNAME }}
github_token=${{ secrets.TOKEN }}
tags: uugai/${{ env.PROJECT }}:latest
- name: Build and push Docker image with release tag
uses: docker/build-push-action@v2
if: github.event.inputs.tag != 'test'
with:
context: .
push: true
build-args: |
github_username=${{ secrets.USERNAME }}
github_token=${{ secrets.TOKEN }}
tags: uugai/${{ env.PROJECT }}:${{ github.event.inputs.tag || github.ref_name }}
# After we build the Docker image, we create a pull request to update the GitOps repository
# This will allow us to update the Helm chart with the new Docker image tag.
#- name: Create GitOps Pull Request
# uses: cedricve/gitops-pullrequest-action@master
# with:
# github-token: ${{ secrets.TOKEN }}
# gitops-repo: "uug-ai/gitops"
# gitops-file: "environments/staging/kerberos-hub/values.yaml"
# gitops-pr-branch: "release-${{ env.PROJECT }}-${{ github.event.inputs.tag || github.ref_name }}"
# gitops-key: "kerberospipeline.${{ env.PROJECT_SHORT }}.tag"
# gitops-value: "${{ github.event.inputs.tag || github.ref_name }}"
# commit-email: "[email protected]"
# commit-name: "GitOps - UUG.AI"
# commit-message: "A new release for Kerberos Hub Pipeline ${{ env.PROJECT_SHORT }} - ${{ github.event.inputs.tag || github.ref_name }}"