chore(chart): bump reloader chart to 0.1.3 #5
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 Helm Chart by Branch | |
| on: | |
| push: | |
| branches: | |
| # - master | |
| - master-copy | |
| paths: | |
| - 'deployments/kubernetes/chart/**' | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: helm-chart-release-branch-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| - name: Ensure gh-pages branch exists | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| SRC_BRANCH="${GITHUB_REF_NAME}" | |
| if ! git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then | |
| echo "Initializing gh-pages branch" | |
| git checkout --orphan gh-pages | |
| git reset --hard | |
| rm -rf ./* .github || true | |
| touch .nojekyll | |
| git add .nojekyll | |
| git commit -m "Initialize gh-pages for Helm chart index" | |
| git push origin gh-pages | |
| # Switch back to the source branch explicitly | |
| git fetch origin "$SRC_BRANCH" --depth=1 | |
| git checkout "$SRC_BRANCH" | |
| fi | |
| - name: Compute branch-specific paths | |
| id: branch | |
| shell: bash | |
| run: | | |
| RAW="${GITHUB_REF_NAME}" | |
| SAFE="${RAW//\//-}" | |
| echo "raw=$RAW" >> $GITHUB_OUTPUT | |
| echo "safe=$SAFE" >> $GITHUB_OUTPUT | |
| OWNER="${{ github.repository_owner }}" | |
| REPO="${GITHUB_REPOSITORY#*/}" | |
| BASE="https://${OWNER}.github.io/${REPO}" | |
| echo "base=$BASE" >> $GITHUB_OUTPUT | |
| echo "index_path=branches/$SAFE" >> $GITHUB_OUTPUT | |
| echo "repo_url=$BASE/branches/$SAFE" >> $GITHUB_OUTPUT | |
| CHART_VERSION=$(grep '^version:' deployments/kubernetes/chart/reloader/Chart.yaml | awk '{print $2}') | |
| echo "chart_version=$CHART_VERSION" >> $GITHUB_OUTPUT | |
| - name: Release with chart-releaser (branch) | |
| uses: helm/chart-releaser-action@v1.6.0 | |
| with: | |
| charts_dir: deployments/kubernetes/chart | |
| mark_as_latest: false | |
| packages_with_index: true | |
| env: | |
| CR_TOKEN: ${{ github.token }} | |
| CR_PAGES_BRANCH: gh-pages | |
| CR_SKIP_EXISTING: true | |
| CR_CHARTS_REPO_URL: ${{ steps.branch.outputs.repo_url }} | |
| - name: Relocate index and packages to branch subfolder | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| SAFE="${{ steps.branch.outputs.safe }}" | |
| CHART_VERSION="${{ steps.branch.outputs.chart_version }}" | |
| # After chart-releaser action, gh-pages is already updated locally | |
| git checkout gh-pages | |
| mkdir -p branches/$SAFE | |
| if [ -f index.yaml ]; then | |
| cp index.yaml branches/$SAFE/index.yaml | |
| fi | |
| for f in *.tgz; do | |
| [ -f "$f" ] || continue | |
| cp "$f" branches/$SAFE/ | |
| done | |
| git add branches/$SAFE | |
| git commit -m "Branch chart repo for $SAFE (version $CHART_VERSION)" || echo "Nothing new to commit" | |
| git push origin gh-pages | |
| git checkout "${GITHUB_REF_NAME}" | |
| # - name: Notify Slack | |
| # uses: 8398a7/action-slack@v3 | |
| # if: always() | |
| # with: | |
| # status: ${{ job.status }} | |
| # fields: repo,author,action,eventName,ref,workflow | |
| # env: | |
| # SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |