diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c008e9dc..dfdf6fee 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -105,3 +105,55 @@ jobs: gh release upload $TAG $f done echo "Charts successfully uploaded to GitHub release $TAG" + + dispatch-dependency: + permissions: + contents: read + id-token: write + actions: write + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: publish-images + if: github.event_name == 'push' && github.ref_type == 'tag' + steps: + - name: Read App Secrets + uses: rancher-eio/read-vault-secrets@main + with: + secrets: | + secret/data/github/repo/${{ github.repository }}/github/workflow-dispatcher/app-credentials appId | APP_ID ; + secret/data/github/repo/${{ github.repository }}/github/workflow-dispatcher/app-credentials privateKey | PRIVATE_KEY + + - name: Create App Token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ env.APP_ID }} + private-key: ${{ env.PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + - name: Run dispatch + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + run: | + case ${{ github.ref_name }} in + "v1.12"*) + ACTION_TARGET_BRANCH="main" + ;; + "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 }}