CI: Sync branch and tag after release (#89967)

* Added `workflow_call` event to allow other workflows to invoke the "Create or update GitHub release"
* Added `dry_run` to `github-release.yml`
* Added `latest` to `release-pr.yml` which will cause the release PR to add a `release/latest` label.
* Removed unnecessary github app creation from github-release workflow and just used permissions.
This commit is contained in:
Kevin Minehart
2024-07-08 14:32:28 -05:00
committed by GitHub
parent c210617735
commit 63e715f6a9
3 changed files with 112 additions and 40 deletions
+24 -10
View File
@@ -24,6 +24,14 @@ on:
required: false
default: false
type: bool
latest:
required: false
default: false
type: bool
permissions:
content: write
pull-requests: write
jobs:
create-prs:
@@ -31,12 +39,6 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'grafana/grafana'
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
- name: Checkout Grafana
uses: actions/checkout@v4
- name: Configure git user
@@ -62,12 +64,24 @@ jobs:
- name: Create PR without backports
if: "${{ inputs.backport == '' }}"
run: >
gh pr create --dry-run=${{ inputs.dry_run }} -B "${{ inputs.target }}" --title "Release: ${{ inputs.version }}" --body "These code changes must be merged after a release is complete"
gh pr create \
$( (( ${{ inputs.latest }} == "true" )) && printf %s '-l "release/latest"') \
--dry-run=${{ inputs.dry_run }} \
-B "${{ inputs.target }}" \
--title "Release: ${{ inputs.version }}" \
--body "These code changes must be merged after a release is complete"
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create PR with backports
if: "${{ inputs.backport != '' }}"
run: >
gh pr create -l "backport ${{ inputs.backport }}" -l "product-approved" --dry-run=${{ inputs.dry_run }} -B "${{ inputs.target }}" --title "Release: ${{ inputs.version }}" --body "These code changes must be merged after a release is complete"
gh pr create \
$( (( ${{ inputs.latest }} == "true" )) && printf %s '-l "release/latest"') \
-l "backport ${{ inputs.backport }}" \
-l "product-approved" \
--dry-run=${{ inputs.dry_run }} \
-B "${{ inputs.target }}" \
--title "Release: ${{ inputs.version }}" \
--body "These code changes must be merged after a release is complete"
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}