From 52a4337703c1e9aaefcf6cd9805557cb6fec1248 Mon Sep 17 00:00:00 2001 From: Matlavv Date: Tue, 19 Nov 2024 14:39:28 +0100 Subject: [PATCH] Try to update helm versionning --- .github/workflows/ci.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 733afb7..cd248f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: fi echo "Latest tag: $latest_tag" echo "tag=$latest_tag" >> $GITHUB_ENV + - name: Determine next version id: set_output run: | @@ -56,15 +57,25 @@ jobs: echo "New version: $new_version" echo "new_version=$new_version" >> $GITHUB_ENV echo "new_version=$new_version" >> $GITHUB_OUTPUT + - name: Update Helm chart version run: | - sed -i "s/version:.*/version: ${{ steps.set_output.outputs.new_version }}/" ${{ env.CHART_PATH }}/Chart.yaml - - name: Create and push new tag + sed -i "s/^version:.*/version: ${{ steps.set_output.outputs.new_version }}/" ${{ env.CHART_PATH }}/Chart.yaml + sed -i "s/^appVersion:.*/appVersion: '${{ steps.set_output.outputs.new_version }}'/" ${{ env.CHART_PATH }}/Chart.yaml + + - name: Commit updated Helm chart version run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' + git add ${{ env.CHART_PATH }}/Chart.yaml + git commit -m "Update Helm chart version to ${{ steps.set_output.outputs.new_version }}" + git push origin HEAD:${{ github.head_ref }} # Push changes to the current branch + + - name: Create and push new tag + run: | git tag ${{ steps.set_output.outputs.new_version }} git push origin ${{ steps.set_output.outputs.new_version }} + build-and-push-docker-api: runs-on: ubuntu-latest needs: determine-version @@ -80,6 +91,7 @@ jobs: key: ${{ runner.os }}-api-node-modules-${{ hashFiles('src/api/package-lock.json') }} restore-keys: | ${{ runner.os }}-api-node-modules- + - name: Install npm dependencies for API working-directory: src/api run: npm install @@ -96,6 +108,7 @@ jobs: key: ${{ runner.os }}-buildx-${{ hashFiles('src/api/Dockerfile', 'src/api/.dockerignore') }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx-${{ hashFiles('src/api/Dockerfile', 'src/api/.dockerignore') }}- + - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -105,6 +118,7 @@ jobs: - name: Build and push Docker image API run: | docker buildx build --platform linux/amd64,linux/arm64 --push -t ${{ env.IMAGE_NAME }}:api-${{ needs.determine-version.outputs.new_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max ./src/api + build-and-push-docker-job: runs-on: ubuntu-latest needs: determine-version @@ -125,6 +139,7 @@ jobs: key: ${{ runner.os }}-buildx-${{ hashFiles('src/Dockerfile', 'src/.dockerignore') }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx-${{ hashFiles('src/Dockerfile', 'src/.dockerignore') }}- + - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -134,6 +149,7 @@ jobs: - name: Build and push Docker image Job run: | docker buildx build --platform linux/amd64,linux/arm64 --push -t ${{ env.IMAGE_NAME }}:job-${{ needs.determine-version.outputs.new_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max ./src + publish-helm-chart: runs-on: ubuntu-latest needs: @@ -160,7 +176,8 @@ jobs: - name: Package Helm chart run: | - helm package opensource + helm package ${{ env.CHART_PATH }} + - name: Push Helm chart to Docker Hub run: | helm push $(ls *.tgz) oci://registry-1.docker.io/amelieloulou