Merge pull request #63 from fastmachinelearning/ytchoutw-patch-1 #78
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: helm release | |
on: | |
push: | |
branches: | |
- "main" | |
jobs: | |
helm-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.0 | |
- name: Configure GitHub | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Configure Git user | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Install dependencies | |
run: | | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm repo add grafana https://grafana.github.io/helm-charts | |
helm repo add opentelemetry https://open-telemetry.github.io/opentelemetry-helm-charts | |
helm repo update | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
with: | |
pages_branch: gh-pages | |
charts_dir: helm | |
skip_existing: true | |
mark_as_latest: true | |
packages_with_index: false | |
- name: Copy artifacthub-repo.yaml to gh-pages | |
run: | | |
# Fetch gh-pages locally so we can switch to it | |
git fetch origin gh-pages:gh-pages | |
# Switch to gh-pages branch | |
git checkout gh-pages | |
# Pull the latest changes from the remote gh-pages branch | |
git pull origin gh-pages | |
# Copy artifacthub-repo.yaml from the current branch | |
git checkout "${{ github.ref }}" -- helm/supersonic/artifacthub-repo.yaml | |
# Move it into the root level as requested | |
mv helm/supersonic/artifacthub-repo.yaml artifacthub-repo.yaml | |
# Stage and commit | |
git add artifacthub-repo.yaml | |
git commit -m "Update artifacthub-repo.yaml from ${{ github.ref }}" --allow-empty | |
# Push to gh-pages | |
echo "Attempting to push to remote branch gh-pages..." | |
if git push origin gh-pages; then | |
echo "Push succeeded." | |
exit 0 | |
else | |
echo "Initial push failed. Fetching latest changes from origin/gh-pages..." | |
git fetch origin gh-pages || { echo "Fetch failed. Exiting."; exit 1; } | |
echo "Rebasing your work onto origin/gh-pages..." | |
git rebase origin/gh-pages || { echo "Rebase failed. Exiting."; exit 1; } | |
echo "Attempting to push again..." | |
if git push origin gh-pages; then | |
echo "Push succeeded after rebasing." | |
exit 0 | |
else | |
echo "Push still failed after rebasing. Exiting." | |
exit 1 | |
fi | |
fi |