diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a772ee9..e66ee59 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,14 +5,16 @@ on: branches: - main +concurrency: + group: release + cancel-in-progress: false + jobs: release: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 + uses: actions/checkout@v5 - name: Configure Git run: | @@ -20,13 +22,13 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4 - name: Add Helm repo run: helm repo add bitnami https://charts.bitnami.com/bitnami - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.5.0 + uses: helm/chart-releaser-action@v1.7.0 env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" with: diff --git a/.github/workflows/update-charts.yml b/.github/workflows/update-charts.yml new file mode 100644 index 0000000..18fb656 --- /dev/null +++ b/.github/workflows/update-charts.yml @@ -0,0 +1,76 @@ +name: Update Charts + +on: + workflow_dispatch: + inputs: + version: + description: "Hatchet version to build (e.g., v0.72.0)" + required: true + type: string + +concurrency: + group: update-charts + cancel-in-progress: false + +jobs: + update-charts: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup Helm + uses: azure/setup-helm@v4 + + - name: Update chart values with new release tag + run: | + RAW_TAG="${{ inputs.version }}" + if ! echo "$RAW_TAG" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?$'; then + echo "Invalid release tag format: $RAW_TAG" >&2 + exit 1 + fi + RELEASE_TAG="$RAW_TAG" + VERSION_NUMBER="${RELEASE_TAG#v}" + + echo "Updating charts to use release tag: $RELEASE_TAG (version: $VERSION_NUMBER)" + + find . -name "values.yaml" -type f | while read -r file; do + echo "Processing values file: $file" + sed -i "s/tag: \"v[^\"]*\"/tag: \"$RELEASE_TAG\"/" "$file" + sed -i "s/tag: v[^[:space:]]*/tag: $RELEASE_TAG/" "$file" + done + + find . -name "Chart.yaml" -type f | while read -r file; do + echo "Processing Chart file: $file" + sed -i "s/^version: .*/version: $VERSION_NUMBER/" "$file" + sed -i '/name: "hatchet-api"/,/version:/ s/version: "[^"]*"/version: "'"$VERSION_NUMBER"'"/' "$file" + sed -i '/name: "hatchet-frontend"/,/version:/ s/version: "[^"]*"/version: "'"$VERSION_NUMBER"'"/' "$file" + done + + find . -name "Chart.lock" -type f | while read -r file; do + echo "Removing Chart.lock file: $file" + rm "$file" + done + + find . -name "Chart.yaml" -type f | while read -r file; do + chart_dir=$(dirname "$file") + if grep -q "dependencies:" "$file"; then + echo "Running helm dependency update in: $chart_dir" + (cd "$chart_dir" && helm dependency update) + fi + done + + echo "Chart version updates and dependency updates complete." + + - name: Commit and push changes + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + if git diff --quiet; then + echo "No changes to commit" + else + git add . + git commit -m "Update charts to use $RELEASE_TAG" + git push + fi