chore: sync upstream paradigmxyz/centaur (20 commits) (#14) #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Chart | |
| "on": | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "contrib/chart/**" | |
| - ".github/workflows/release-chart.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "contrib/chart/**" | |
| - ".github/workflows/release-chart.yml" | |
| permissions: {} | |
| jobs: | |
| release: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| - name: Bootstrap gh-pages branch | |
| if: github.event_name == 'push' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then | |
| echo "gh-pages branch already exists" | |
| else | |
| echo "Creating empty gh-pages branch" | |
| git switch --orphan gh-pages | |
| git commit --allow-empty -m "chore: initialize gh-pages" | |
| git push origin gh-pages | |
| git switch - | |
| fi | |
| - name: Set up Helm | |
| uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4 | |
| with: | |
| version: v4.1.1 | |
| - name: Lint chart | |
| run: helm lint contrib/chart | |
| - name: Install yq | |
| uses: mikefarah/yq@5a7e72a743649b1b3a47d1a1d8214f3453173c51 # v4 | |
| - name: Validate chart version bump | |
| run: | | |
| set -e | |
| CHART_YAML="contrib/chart/Chart.yaml" | |
| if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then | |
| git fetch --no-tags origin "${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}" | |
| BASE_REF="origin/${GITHUB_BASE_REF}" | |
| CHANGED_FILES=$(git diff --name-only "${BASE_REF}...HEAD" 2>/dev/null || echo "") | |
| PREVIOUS_VERSION=$(git show "${BASE_REF}:${CHART_YAML}" 2>/dev/null | yq '.version' 2>/dev/null || echo "") | |
| else | |
| CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || echo "") | |
| PREVIOUS_VERSION=$(git show HEAD~1:"$CHART_YAML" 2>/dev/null | yq '.version' 2>/dev/null || echo "") | |
| fi | |
| if ! echo "$CHANGED_FILES" | grep -q "^contrib/chart/"; then | |
| echo "No chart changes detected" | |
| exit 0 | |
| fi | |
| CURRENT_VERSION=$(yq '.version' "$CHART_YAML") | |
| if [ -n "$PREVIOUS_VERSION" ] && [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then | |
| echo "Version already bumped ($PREVIOUS_VERSION -> $CURRENT_VERSION)" | |
| exit 0 | |
| fi | |
| echo "::error file=${CHART_YAML}::contrib/chart changed but chart version stayed at ${CURRENT_VERSION}. Bump .version in the PR." | |
| exit 1 | |
| - name: Run chart-releaser | |
| if: github.event_name == 'push' | |
| uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0 | |
| with: | |
| skip_existing: true | |
| charts_dir: contrib | |
| env: | |
| CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |