Skip to content

Merge pull request #164 from DataCloud-project/imageref-hotfix #68

Merge pull request #164 from DataCloud-project/imageref-hotfix

Merge pull request #164 from DataCloud-project/imageref-hotfix #68

name: Build Helm chart and publish OCI image
on:
push:
branches:
- main
- dev
tags:
- "*"
pull_request:
paths:
- "charts/**"
jobs:
build-helm-chart-and-publish-oci:
name: Build Helm chart and publish OCI image
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.determine_semver.outputs.semver }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# fetch all history for all tags
fetch-depth: 0
- name: Determine Semver
id: determine_semver
run: |
# Determine if it's a tag, branch or PR
REF_TYPE=$(echo $GITHUB_REF | cut -d'/' -f2)
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
# If it's a tag, just echo the tag name
SEMVER=${GITHUB_REF##*/}
else
# If it's not a tag, get the latest tag
LATEST_TAG=$(git describe --tags --abbrev=0)
if [[ "$REF_TYPE" == "heads" ]]; then
# If it's a branch, append branch name to the latest tag
SEMVER="$LATEST_TAG+${GITHUB_REF##*/}"
elif [[ "$REF_TYPE" == "pull" ]]; then
# Extract PR number from the ref
PR_NUMBER=$(echo $GITHUB_REF | cut -d'/' -f3)
# Append PR number to the latest tag
SEMVER="$LATEST_TAG+pr$PR_NUMBER"
fi
fi
echo semver=$SEMVER >> $GITHUB_OUTPUT
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.12.3
- name: Push
uses: appany/[email protected]
with:
name: simpipe
repository: datacloud-project
tag: ${{ steps.determine_semver.outputs.semver }}
registry: ghcr.io
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}