Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 15 additions & 61 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,46 +105,14 @@ jobs:
gh release upload $TAG $f
done
echo "Charts successfully uploaded to GitHub release $TAG"
- name: Add charts to branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r '.version')
branch_version=v$(echo "$version" | cut -d'.' -f1,2)
charts_branch=charts/$branch_version
if [ ! -e ~/.gitconfig ]; then
git config --global user.name "aks-operator-bot"
git config --global user.email aks-operator@suse.de
fi
echo "Publishing helm chart in the branch $charts_branch"
if ! git ls-remote --exit-code --heads origin "$charts_branch"; then
git checkout --orphan "$charts_branch"
git rm -rf .
echo "# AKS Operator Helm Charts for $branch_version versions" > README.md
echo "The documentation is centralized in a unique place, checkout https://github.com/rancher/aks-operator." >> README.md
git checkout origin/main -- License .gitignore
git add README.md License .gitignore
git commit -m "Initial commit for $charts_branch"
else
git checkout .
git checkout "$charts_branch"
fi
mkdir -p charts
for f in $(find bin/ -name '*.tgz'); do
tar -xf $f -C charts/
done
git add charts/**/*
git commit -m "Update charts to version $version"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git push origin "$charts_branch"
dispatch-dependency:

dispatch-chart-release:
permissions:
contents: read
id-token: write
actions: write
runs-on: ubuntu-latest
timeout-minutes: 10
needs: publish-images
needs: release
if: github.event_name == 'push' && github.ref_type == 'tag'
steps:
- name: Read App Secrets
Expand All @@ -162,32 +130,18 @@ jobs:
private-key: ${{ env.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Run dispatch
- name: Dispatch to rancher/charts
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
case ${{ github.ref_name }} in
"v1.13"*)
ACTION_TARGET_BRANCH="main"
;;
"v1.12"*)
ACTION_TARGET_BRANCH="release/v2.12"
;;
"v1.11"*)
ACTION_TARGET_BRANCH="release/v2.11"
;;
"v1.10"*)
ACTION_TARGET_BRANCH="release/v2.10"
;;
"v1.9"*)
ACTION_TARGET_BRANCH="release/v2.9"
;;
"v1.3"*)
ACTION_TARGET_BRANCH="release/v2.8"
;;
*)
echo "Not a valid tag, not dispatching event"
exit 0
esac
echo "Running Go get on $ACTION_TARGET_BRANCH"
gh workflow run "Go get" --repo rancher/rancher --ref $ACTION_TARGET_BRANCH -F goget_module=github.com/rancher/aks-operator -F goget_version=${{ github.ref_name }} -F source_author=${{ github.actor }}
CURRENT_BRANCH="${{ github.ref_name }}"
BASE_VERSION=$(echo "$CURRENT_BRANCH" | sed -E 's/^[^v]*(v[0-9]+\.[0-9]+).*/\1/')
TRANSFORMED_VERSION="${BASE_VERSION/v1./v2.}"
TARGET_BRANCH="dev-${TRANSFORMED_VERSION}"
VERSION_OVERRIDE="minor"
gh workflow run "Manual Trigger for Auto Bump" \
--repo rancher/charts \
--ref "$TARGET_BRANCH" \
-F chart=rancher-aks-operator \
-F branch="$TARGET_BRANCH" \
-F version-override=$VERSION_OVERRIDE