diff --git a/.github/workflows/crik-publish.yaml b/.github/workflows/crik-publish.yaml index 4fe1e32..31a88b5 100644 --- a/.github/workflows/crik-publish.yaml +++ b/.github/workflows/crik-publish.yaml @@ -12,6 +12,8 @@ env: jobs: version: runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.VERSION }} steps: - name: Checkout uses: actions/checkout@v4 @@ -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 images: runs-on: ubuntu-latest - needs: version + needs: + - version permissions: packages: write contents: read @@ -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 @@ -126,6 +129,7 @@ jobs: runs-on: ubuntu-latest needs: - images + - version strategy: matrix: chart: [node-state-server] @@ -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