Skip to content

v1.3.1

v1.3.1 #66

Workflow file for this run

name: Release
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
release:
types: [published]
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
ARTIFACT_DIR: ./release
HELM_PACKAGE_DIR: helm
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.20'
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Build
env:
VERSION: ${{ env.RELEASE_VERSION }}
run: make build-linux
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images
env:
DOCKER_REGISTRY: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
DOCKER_TAG: ${{ env.RELEASE_VERSION }}
run: make docker-build
- name: Push images
env:
DOCKER_REGISTRY: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
DOCKER_TAG: ${{ env.RELEASE_VERSION }}
run: make docker-push
- name: Package Helm chart
if: ${{ env.LATEST_RELEASE }} == "true"
env:
HELM_CHARTS_DIR: helm
run: |
sed -i "/ tag:/c\ tag: \"${{ env.RELEASE_VERSION }}\"" ${{ env.HELM_CHARTS_DIR }}/values.yaml
mkdir -p ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }}
helm package ${{ env.HELM_CHARTS_DIR }} --app-version ${{ env.RELEASE_VERSION }} --version ${{ env.RELEASE_VERSION }} --destination ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }}
- name: Checkout Helm Charts Repo
uses: actions/checkout@v2
env:
HELM_REPO: osstotalsoft/helm-charts
HELM_REPO_CODE_PATH: helm-charts
with:
repository: ${{ env.HELM_REPO }}
ref: refs/heads/main
token: ${{ secrets.BOT_TOKEN }}
path: ${{ env.HELM_REPO_CODE_PATH }}
- name: Upload helm charts to Helm Repo
env:
HELM_REPO_CODE_PATH: helm-charts
HELM_REPO: https://osstotalsoft.github.io/helm-charts/
run: |
cd ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }}
cp -r * $GITHUB_WORKSPACE/${{ env.HELM_REPO_CODE_PATH }}
cd $GITHUB_WORKSPACE/${{ env.HELM_REPO_CODE_PATH }}
helm repo index --url ${{ env.HELM_REPO }} --merge index.yaml .
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions"
git add --all
git commit -m "Release - ${{ env.RELEASE_VERSION }}"
git push