Skip to content

Commit ccc23bf

Browse files
authored
ci: use github-app-token-broker for GH app access (#2707)
1 parent 30aaba1 commit ccc23bf

1 file changed

Lines changed: 9 additions & 23 deletions

File tree

.github/workflows/release.yaml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,11 @@ jobs:
5757
tar -xzf cr.tar.gz -C "${CR_TOOL_PATH}"
5858
rm -f cr.tar.gz
5959
60-
- name: Get secrets
61-
id: secrets
62-
uses: grafana/shared-workflows/actions/get-vault-secrets@a53fc80bc30b0a16a262520465db899fa3af08b7 # get-vault-secrets/v1.3.2
63-
with:
64-
repo_secrets: |
65-
APP_ID=helm-release-github-app:app-id
66-
APP_PRIVATE_KEY=helm-release-github-app:private-key
67-
export_env: false
68-
69-
- name: Create a GitHub App installation access token
70-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
71-
id: app-token
60+
- name: Get GitHub App token
61+
id: get-github-app-token
62+
uses: grafana/shared-workflows/actions/create-github-app-token@580590a644e82e79bb2598bdaba0be245a14dda0 # create-github-app-token/v0.2.2
7263
with:
73-
app-id: ${{ fromJSON(steps.secrets.outputs.secrets || '{}').APP_ID }}
74-
private-key: ${{ fromJSON(steps.secrets.outputs.secrets || '{}').APP_PRIVATE_KEY }}
75-
repositories: helm-charts
76-
owner: "${{ github.event.repository.owner.login }}"
77-
78-
- name: Set the correct token (Github App or PAT) # zizmor: ignore[template-injection] app token considered safe
79-
run: |
80-
echo "AUTHTOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV
64+
github_app: grafana-operator-helm-release
8165

8266
- name: Make github release
8367
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
@@ -90,15 +74,15 @@ jobs:
9074
source/deploy/helm/grafana-operator-${{ env.HELM_RELEASE_VERSION }}.tgz
9175
repository: grafana/helm-charts
9276
tag_name: grafana-operator-${{ env.HELM_RELEASE_VERSION }}
93-
token: ${{ env.AUTHTOKEN }}
77+
token: ${{ steps.get-github-app-token.outputs.token }}
9478

9579
- name: Checkout helm-charts # zizmor: ignore[artipacked] required to push using chart releaser in last step
9680
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
9781
with:
9882
fetch-depth: 0
9983
repository: grafana/helm-charts
10084
path: helm-charts
101-
token: ${{ env.AUTHTOKEN }}
85+
token: ${{ steps.get-github-app-token.outputs.token }}
10286

10387
- name: Configure Git for helm-charts
10488
run: |
@@ -107,9 +91,11 @@ jobs:
10791
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
10892
10993
- name: Update helm repo index.yaml
94+
env:
95+
AUTHTOKEN: ${{ steps.get-github-app-token.outputs.token }}
11096
run: |
11197
cd helm-charts
112-
"${CR_TOOL_PATH}/cr" index --config ../source/deploy/helm/cr.yaml --token "${{ env.AUTHTOKEN }}" --index-path "${CR_INDEX_PATH}" --package-path ../source/deploy/helm/ --push
98+
"${CR_TOOL_PATH}/cr" index --config ../source/deploy/helm/cr.yaml --token "$AUTHTOKEN" --index-path "${CR_INDEX_PATH}" --package-path ../source/deploy/helm/ --push
11399
114100
kustomize:
115101
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)