name: Build and push image on: push: branches: - main jobs: build: runs-on: ubuntu-latest permissions: contents: write packages: write steps: - name: Checkout uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Set image tag id: tag run: echo "value=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v6 with: context: . file: container/Containerfile platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.value }} cache-from: type=gha cache-to: type=gha,mode=max - name: Bump chart version and set appVersion id: chart run: | CURRENT=$(grep '^version:' helm/Chart.yaml | awk '{print $2}') MAJOR=$(echo $CURRENT | cut -d. -f1) MINOR=$(echo $CURRENT | cut -d. -f2) PATCH=$(echo $CURRENT | cut -d. -f3) NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" sed -i "s/^version: .*/version: $NEW_VERSION/" helm/Chart.yaml sed -i "s/^appVersion: .*/appVersion: \"${{ steps.tag.outputs.value }}\"/" helm/Chart.yaml echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - name: Commit and push chart update run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add helm/Chart.yaml git commit -m "chore: chart ${{ steps.chart.outputs.version }}, appVersion ${{ steps.tag.outputs.value }} [skip ci]" git push