Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release workflows to use GitHub App instead of PATs #432

Merged
Merged
Show file tree
Hide file tree
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
18 changes: 15 additions & 3 deletions .github/workflows/update-release-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,23 @@ jobs:

echo "check-run-head-sha=$CHECK_RUN_HEAD_SHA" >> "$GITHUB_OUTPUT"

generate-token:
runs-on: ubuntu-latest
outputs:
token: ${{ steps.generate-token.outputs.token }}
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@eaddb9eb7e4226c68cf4b39f167c83e5bd132b3e
with:
app_id: ${{ vars.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}

update-release:
needs: validate-check-runs
needs: [validate-check-runs, generate-token]
if: needs.validate-check-runs.outputs.status == 'completed'
uses: ./.github/workflows/update-release.yml
with:
head-sha: ${{ needs.validate-check-runs.outputs.check-run-head-sha }}
head-sha: ${{ needs.validate-check-runs.outputs.check-run-head-sha }}
secrets:
RELEASE_ENGINEERING_TOKEN: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
RELEASE_ENGINEERING_TOKEN: ${{ generate-token.outputs.token }}
15 changes: 14 additions & 1 deletion .github/workflows/update-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ env:
HEAD_SHA: ${{ inputs.head-sha }}

jobs:
generate-token:
runs-on: ubuntu-latest
outputs:
token: ${{ steps.generate-token.outputs.token }}
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@eaddb9eb7e4226c68cf4b39f167c83e5bd132b3e
with:
app_id: ${{ vars.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}

update-release:
name: "Update release"
needs: generate-token
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand All @@ -43,7 +56,7 @@ jobs:
- name: Update release assets
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_ENGINEERING_TOKEN: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
RELEASE_ENGINEERING_TOKEN: ${{ generate-token.outputs.token }}
run: |
python scripts/release/update-release-assets.py \
--head-sha $HEAD_SHA \
Expand Down
30 changes: 21 additions & 9 deletions .github/workflows/validate-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}

jobs:
generate-token:
runs-on: ubuntu-latest
outputs:
token: ${{ steps.generate-token.outputs.token }}
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@eaddb9eb7e4226c68cf4b39f167c83e5bd132b3e
with:
app_id: ${{ vars.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}

pre-validate-performance:
outputs:
Expand All @@ -36,13 +47,13 @@ jobs:
echo "check-run-id=$check_run_id" >> "$GITHUB_OUTPUT"

validate-performance:
needs: pre-validate-performance
needs: [pre-validate-performance, generate-token]
runs-on: ubuntu-22.04
steps:
- name: Invoke performance test
env:
CHECK_RUN_ID: ${{ needs.pre-validate-performance.outputs.check-run-id }}
GH_TOKEN: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
GH_TOKEN: ${{ generate-token.outputs.token }}
run: |
jq -n \
--arg ref "$HEAD_SHA" \
Expand All @@ -61,8 +72,8 @@ jobs:
steps:
- name: Fail check run status
env:
CHECK_RUN_ID: ${{ needs.pre-validate-performance.outputs.check-run-id }}
GITHUB_TOKEN: ${{ github.token }}
CHECK_RUN_ID: ${{ needs.pre-validate-performance.outputs.check-run-id }}
GITHUB_TOKEN: ${{ github.token }}
run: |
jq -n \
--arg status "completed" \
Expand Down Expand Up @@ -97,13 +108,13 @@ jobs:
echo "check-run-id=$check_run_id" >> "$GITHUB_OUTPUT"

validate-compiler-compatibility:
needs: pre-validate-compiler-compatibility
needs: [pre-validate-compiler-compatibility, generate-token]
runs-on: ubuntu-22.04
steps:
- name: Invoke compiler compatibility test
env:
CHECK_RUN_ID: ${{ needs.pre-validate-compiler-compatibility.outputs.check-run-id }}
GITHUB_TOKEN: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
GITHUB_TOKEN: ${{ generate-token.outputs.token }}
run: |
jq -n \
--arg ref "$HEAD_SHA" \
Expand All @@ -116,14 +127,15 @@ jobs:
--ref rvermeulen/release-process

on-failure-validate-compiler-compatibility-dispatch:
needs: [pre-validate-compiler-compatibility, validate-compiler-compatibility]
needs:
[pre-validate-compiler-compatibility, validate-compiler-compatibility]
if: failure()
runs-on: ubuntu-22.04
steps:
- name: Fail check run status
env:
CHECK_RUN_ID: ${{ needs.pre-validate-compiler-compatibility.outputs.check-run-id }}
GITHUB_TOKEN: ${{ github.token }}
CHECK_RUN_ID: ${{ needs.pre-validate-compiler-compatibility.outputs.check-run-id }}
GITHUB_TOKEN: ${{ github.token }}
run: |
jq -n \
--arg status "completed" \
Expand Down
Loading