Skip to content

Commit

Permalink
github: fix helm push version to not have v prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Muvaffak Onus <me@muvaf.com>
  • Loading branch information
muvaf committed May 15, 2024
1 parent 9338073 commit 0332f67
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/crik-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ env:
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -27,14 +29,15 @@ jobs:
echo "No tags found"
VERSION="$(echo "v0.0.0-$(git rev-list HEAD --count)-$(git describe --dirty --always)" | sed 's/-/./2' | sed 's/-/./2' | sed 's/-/./2')"
else
echo "Tags found: $(git tag)"
echo "Tags found:\n$(git tag)"
VERSION="$(git describe --dirty --always --tags --match 'v*' | sed 's|.*/||' | sed 's/-/./2' | sed 's/-/./2' | sed 's/-/./2')"
fi
echo "Version is ${VERSION}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
images:
runs-on: ubuntu-latest
needs: version
needs:
- version
permissions:
packages: write
contents: read
Expand Down Expand Up @@ -100,7 +103,7 @@ jobs:
tags: |
type=ref,event=branch
type=sha,format=short,prefix=
${{ steps.version.outputs.VERSION }}
${{ needs.version.outputs.VERSION }}
- name: Build and push
id: push
uses: docker/build-push-action@v5
Expand All @@ -126,6 +129,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- images
- version
strategy:
matrix:
chart: [node-state-server]
Expand All @@ -141,17 +145,17 @@ jobs:
- name: Push the chart
id: push
env:
VERSION: ${{ steps.version.outputs.VERSION }}
VERSION: ${{ needs.version.outputs.VERSION }}
run: |
# Helm doesn't accept v prefix in version.
TAG=$(echo ${{ steps.version.outputs.VERSION }} | cut -d'v' -f2)
CHART_TAG=$(echo ${VERSION} | cut -d'v' -f2)
if [ "${{ matrix.chart }}" == "node-state-server" ]; then
yq -i ".nodeStateServer.image.tag = \"${VERSION}\"" cluster/charts/${{ matrix.chart }}/values.yaml
echo "Final values.yaml"
cat cluster/charts/${{ matrix.chart }}/values.yaml
fi
helm dependency update cluster/charts/${{ matrix.chart }}
helm package cluster/charts/${{ matrix.chart }} --dependency-update --version=${VERSION} --app-version=${VERSION}
helm package cluster/charts/${{ matrix.chart }} --dependency-update --version=${CHART_TAG} --app-version=${CHART_TAG}
OUT=$(set +e; helm push ${{ matrix.chart }}-${VERSION}.tgz oci://ghcr.io/qawolf/crik/charts 2>&1)
EXIT_CODE=$?
set -e
Expand Down

0 comments on commit 0332f67

Please sign in to comment.