Skip to content

Commit c348652

Browse files
authored
Merge pull request #1620 from swastik959/dispatch-v2.11
[v2.11]removed dispatch dependency workflow
2 parents 434be54 + fabdcbd commit c348652

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed

.github/workflows/release.yaml

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -106,56 +106,47 @@ jobs:
106106
gh release upload $TAG $f
107107
done
108108
echo "Charts successfully uploaded to GitHub release $TAG"
109-
110109
- name: Add charts to branch
111110
env:
112111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113112
run: |
114113
version=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r '.version')
115114
branch_version=v$(echo "$version" | cut -d'.' -f1,2)
116115
charts_branch=charts/$branch_version
117-
118116
if [ ! -e ~/.gitconfig ]; then
119117
git config --global user.name "eks-operator-bot"
120118
git config --global user.email [email protected]
121119
fi
122-
123120
echo "Publishing helm chart in the branch $charts_branch"
124121
if ! git ls-remote --exit-code --heads origin "$charts_branch"; then
125122
git checkout --orphan "$charts_branch"
126123
git rm -rf .
127-
128124
echo "# EKS Operator Helm Charts for $branch_version versions" > README.md
129125
echo "The documentation is centralized in a unique place, checkout https://github.com/rancher/eks-operator." >> README.md
130-
131126
git checkout origin/main -- License .gitignore
132-
133127
git add README.md License .gitignore
134128
git commit -m "Initial commit for $charts_branch"
135129
else
136130
git checkout .
137131
git checkout "$charts_branch"
138132
fi
139-
140133
mkdir -p charts
141134
for f in $(find bin/ -name '*.tgz'); do
142135
tar -xf $f -C charts/
143136
done
144-
145137
git add charts/**/*
146138
git commit -m "Update charts to version $version"
147-
148139
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
149140
git push origin "$charts_branch"
150-
151-
dispatch-dependency:
141+
142+
dispatch-chart-release:
152143
permissions:
153144
contents: read
154145
id-token: write
155146
actions: write
156147
runs-on: ubuntu-latest
157148
timeout-minutes: 10
158-
needs: publish-images
149+
needs: release
159150
if: github.event_name == 'push' && github.ref_type == 'tag'
160151
steps:
161152
- name: Read App Secrets
@@ -164,38 +155,25 @@ jobs:
164155
secrets: |
165156
secret/data/github/repo/${{ github.repository }}/github/workflow-dispatcher/app-credentials appId | APP_ID ;
166157
secret/data/github/repo/${{ github.repository }}/github/workflow-dispatcher/app-credentials privateKey | PRIVATE_KEY
167-
168158
- name: Create App Token
169159
uses: actions/create-github-app-token@v1
170160
id: app-token
171161
with:
172162
app-id: ${{ env.APP_ID }}
173163
private-key: ${{ env.PRIVATE_KEY }}
174164
owner: ${{ github.repository_owner }}
175-
176-
- name: Run dispatch
165+
- name: Dispatch to rancher/charts
177166
env:
178167
GH_TOKEN: ${{ steps.app-token.outputs.token }}
179168
run: |
180-
case ${{ github.ref_name }} in
181-
"v1.12"*)
182-
ACTION_TARGET_BRANCH="main"
183-
;;
184-
"v1.11"*)
185-
ACTION_TARGET_BRANCH="release/v2.11"
186-
;;
187-
"v1.10"*)
188-
ACTION_TARGET_BRANCH="release/v2.10"
189-
;;
190-
"v1.9"*)
191-
ACTION_TARGET_BRANCH="release/v2.9"
192-
;;
193-
"v1.3"*)
194-
ACTION_TARGET_BRANCH="release/v2.8"
195-
;;
196-
*)
197-
echo "Not a valid tag, not dispatching event"
198-
exit 0
199-
esac
200-
echo "Running Go get on $ACTION_TARGET_BRANCH"
201-
gh workflow run "Go get" --repo rancher/rancher --ref $ACTION_TARGET_BRANCH -F goget_module=github.com/rancher/eks-operator -F goget_version=${{ github.ref_name }} -F source_author=${{ github.actor }}
169+
CURRENT_BRANCH="${{ github.ref_name }}"
170+
BASE_VERSION=$(echo "$CURRENT_BRANCH" | sed -E 's/^[^v]*(v[0-9]+\.[0-9]+).*/\1/')
171+
TRANSFORMED_VERSION="${BASE_VERSION/v1./v2.}"
172+
TARGET_BRANCH="dev-${TRANSFORMED_VERSION}"
173+
VERSION_OVERRIDE="minor"
174+
gh workflow run "Manual Trigger for Auto Bump" \
175+
--repo rancher/charts \
176+
--ref "$TARGET_BRANCH" \
177+
-F chart=rancher-eks-operator \
178+
-F branch="$TARGET_BRANCH" \
179+
-F version-override=$VERSION_OVERRIDE

0 commit comments

Comments
 (0)