|
|
@ -15,15 +15,19 @@ on: |
|
|
|
version: |
|
|
|
version: |
|
|
|
required: true |
|
|
|
required: true |
|
|
|
type: string |
|
|
|
type: string |
|
|
|
description: The version of Grafana that is being released |
|
|
|
description: The version of Grafana that is being released (without the `v` prefix)` |
|
|
|
target: |
|
|
|
target: |
|
|
|
required: true |
|
|
|
required: true |
|
|
|
type: string |
|
|
|
type: string |
|
|
|
description: The release branch pattern (eg v9.5.x) that these changes are being merged into |
|
|
|
description: The release branch pattern (eg v9.5.x) that these changes are being merged into |
|
|
|
backport: |
|
|
|
changelog: |
|
|
|
required: false |
|
|
|
required: false |
|
|
|
type: string |
|
|
|
type: boolean |
|
|
|
description: Branch to backport these changes to |
|
|
|
default: true |
|
|
|
|
|
|
|
bump: |
|
|
|
|
|
|
|
required: false |
|
|
|
|
|
|
|
type: boolean |
|
|
|
|
|
|
|
default: true |
|
|
|
dry_run: |
|
|
|
dry_run: |
|
|
|
required: false |
|
|
|
required: false |
|
|
|
default: false |
|
|
|
default: false |
|
|
@ -41,6 +45,7 @@ jobs: |
|
|
|
push-changelog-to-main: |
|
|
|
push-changelog-to-main: |
|
|
|
permissions: |
|
|
|
permissions: |
|
|
|
contents: write |
|
|
|
contents: write |
|
|
|
|
|
|
|
id-token: write |
|
|
|
pull-requests: write |
|
|
|
pull-requests: write |
|
|
|
name: Create PR to main to update the changelog |
|
|
|
name: Create PR to main to update the changelog |
|
|
|
uses: ./.github/workflows/changelog.yml |
|
|
|
uses: ./.github/workflows/changelog.yml |
|
|
@ -54,6 +59,7 @@ jobs: |
|
|
|
create-prs: |
|
|
|
create-prs: |
|
|
|
permissions: |
|
|
|
permissions: |
|
|
|
contents: write |
|
|
|
contents: write |
|
|
|
|
|
|
|
id-token: write |
|
|
|
pull-requests: write |
|
|
|
pull-requests: write |
|
|
|
name: Create Release PR |
|
|
|
name: Create Release PR |
|
|
|
runs-on: ubuntu-latest |
|
|
|
runs-on: ubuntu-latest |
|
|
@ -70,29 +76,20 @@ jobs: |
|
|
|
# Secrets placed in the ci/data/repo/grafana/grafana/delivery-bot-app path in Vault |
|
|
|
# Secrets placed in the ci/data/repo/grafana/grafana/delivery-bot-app path in Vault |
|
|
|
repo_secrets: | |
|
|
|
repo_secrets: | |
|
|
|
GRAFANA_DELIVERY_BOT_APP_PEM=delivery-bot-app:PRIVATE_KEY |
|
|
|
GRAFANA_DELIVERY_BOT_APP_PEM=delivery-bot-app:PRIVATE_KEY |
|
|
|
- name: Get release branch |
|
|
|
- run: echo "RELEASE_BRANCH=release-${VERSION}" >> "$GITHUB_ENV" |
|
|
|
id: branch |
|
|
|
|
|
|
|
uses: grafana/grafana-github-actions-go/latest-release-branch@main # zizmor: ignore[unpinned-uses] |
|
|
|
|
|
|
|
with: |
|
|
|
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
|
|
|
|
ownerRepo: 'grafana/grafana' |
|
|
|
|
|
|
|
pattern: ${{ inputs.target }} |
|
|
|
|
|
|
|
- name: Checkout Grafana |
|
|
|
- name: Checkout Grafana |
|
|
|
uses: actions/checkout@v4 |
|
|
|
uses: actions/checkout@v4 |
|
|
|
with: |
|
|
|
with: |
|
|
|
ref: ${{ steps.branch.outputs.branch }} |
|
|
|
ref: ${{ env.RELEASE_BRANCH }} |
|
|
|
fetch-tags: true |
|
|
|
fetch-tags: true |
|
|
|
token: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
fetch-depth: 0 |
|
|
|
persist-credentials: false |
|
|
|
|
|
|
|
- name: Checkout Grafana (main) |
|
|
|
- name: Checkout Grafana (main) |
|
|
|
uses: actions/checkout@v4 |
|
|
|
uses: actions/checkout@v4 |
|
|
|
with: |
|
|
|
with: |
|
|
|
ref: main |
|
|
|
ref: main |
|
|
|
fetch-depth: '0' |
|
|
|
fetch-depth: '0' |
|
|
|
fetch-tags: 'false' |
|
|
|
|
|
|
|
path: .grafana-main |
|
|
|
path: .grafana-main |
|
|
|
token: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
|
|
|
|
persist-credentials: false |
|
|
|
|
|
|
|
- name: Setup nodejs environment |
|
|
|
- name: Setup nodejs environment |
|
|
|
uses: actions/setup-node@v4 |
|
|
|
uses: actions/setup-node@v4 |
|
|
|
with: |
|
|
|
with: |
|
|
@ -104,8 +101,9 @@ jobs: |
|
|
|
git config --local --add --bool push.autoSetupRemote true |
|
|
|
git config --local --add --bool push.autoSetupRemote true |
|
|
|
|
|
|
|
|
|
|
|
- name: Create branch |
|
|
|
- name: Create branch |
|
|
|
run: git checkout -b "release/${{ github.run_id }}/$VERSION" |
|
|
|
run: git checkout -b "release/${{ github.run_number }}/$VERSION" |
|
|
|
- name: Generate changelog token |
|
|
|
- name: Generate changelog token |
|
|
|
|
|
|
|
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }} |
|
|
|
id: generate_changelog_token |
|
|
|
id: generate_changelog_token |
|
|
|
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 |
|
|
|
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 |
|
|
|
with: |
|
|
|
with: |
|
|
@ -113,12 +111,15 @@ jobs: |
|
|
|
private_key: ${{ env.GRAFANA_DELIVERY_BOT_APP_PEM }} |
|
|
|
private_key: ${{ env.GRAFANA_DELIVERY_BOT_APP_PEM }} |
|
|
|
- name: Generate changelog |
|
|
|
- name: Generate changelog |
|
|
|
id: changelog |
|
|
|
id: changelog |
|
|
|
|
|
|
|
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }} |
|
|
|
uses: ./.grafana-main/.github/actions/changelog |
|
|
|
uses: ./.grafana-main/.github/actions/changelog |
|
|
|
with: |
|
|
|
with: |
|
|
|
|
|
|
|
previous: ${{inputs.previous_version}} |
|
|
|
github_token: ${{ steps.generate_changelog_token.outputs.token }} |
|
|
|
github_token: ${{ steps.generate_changelog_token.outputs.token }} |
|
|
|
target: v${{ env.VERSION }} |
|
|
|
target: v${{ env.VERSION }} |
|
|
|
output_file: changelog_items.md |
|
|
|
output_file: changelog_items.md |
|
|
|
- name: Patch CHANGELOG.md |
|
|
|
- name: Patch CHANGELOG.md |
|
|
|
|
|
|
|
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }} |
|
|
|
run: | |
|
|
|
run: | |
|
|
|
# Prepare CHANGELOG.md content with version delimiters |
|
|
|
# Prepare CHANGELOG.md content with version delimiters |
|
|
|
( |
|
|
|
( |
|
|
@ -150,16 +151,20 @@ jobs: |
|
|
|
|
|
|
|
|
|
|
|
git diff CHANGELOG.md |
|
|
|
git diff CHANGELOG.md |
|
|
|
- name: "Prettify CHANGELOG.md" |
|
|
|
- name: "Prettify CHANGELOG.md" |
|
|
|
|
|
|
|
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }} |
|
|
|
run: npx prettier --write CHANGELOG.md |
|
|
|
run: npx prettier --write CHANGELOG.md |
|
|
|
- name: Commit CHANGELOG.md changes |
|
|
|
- name: Commit CHANGELOG.md changes |
|
|
|
|
|
|
|
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }} |
|
|
|
run: git add CHANGELOG.md && git commit --allow-empty -m "Update changelog" CHANGELOG.md |
|
|
|
run: git add CHANGELOG.md && git commit --allow-empty -m "Update changelog" CHANGELOG.md |
|
|
|
|
|
|
|
|
|
|
|
- name: Update package.json versions |
|
|
|
- name: Update package.json versions |
|
|
|
|
|
|
|
if: ${{ inputs.bump == true || inputs.bump == 'true' }} |
|
|
|
uses: ./.grafana-main/pkg/build/actions/bump-version |
|
|
|
uses: ./.grafana-main/pkg/build/actions/bump-version |
|
|
|
with: |
|
|
|
with: |
|
|
|
version: 'patch' |
|
|
|
version: 'patch' |
|
|
|
|
|
|
|
|
|
|
|
- name: Add package.json changes |
|
|
|
- name: Add package.json changes |
|
|
|
|
|
|
|
if: ${{ inputs.bump == true || inputs.bump == 'true' }} |
|
|
|
run: | |
|
|
|
run: | |
|
|
|
git add package.json lerna.json yarn.lock packages public |
|
|
|
git add package.json lerna.json yarn.lock packages public |
|
|
|
test -e e2e/test-plugins && git add e2e/test-plugins |
|
|
|
test -e e2e/test-plugins && git add e2e/test-plugins |
|
|
@ -167,28 +172,8 @@ jobs: |
|
|
|
|
|
|
|
|
|
|
|
- name: Git push |
|
|
|
- name: Git push |
|
|
|
if: inputs.dry_run != true |
|
|
|
if: inputs.dry_run != true |
|
|
|
run: git push --set-upstream origin "release/${{ github.run_id }}/$VERSION" |
|
|
|
run: git push |
|
|
|
|
|
|
|
- name: Create PR |
|
|
|
- name: Create PR without backports |
|
|
|
|
|
|
|
if: "${{ inputs.backport == '' }}" |
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
|
|
|
|
BRANCH: ${{ steps.branch.outputs.branch }} |
|
|
|
|
|
|
|
run: | |
|
|
|
|
|
|
|
LATEST_FLAG="" |
|
|
|
|
|
|
|
if [ "$LATEST" = "true" ]; then |
|
|
|
|
|
|
|
LATEST_FLAG=(-l "release/latest") |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
gh pr create \ |
|
|
|
|
|
|
|
"${LATEST_FLAG[@]}" \ |
|
|
|
|
|
|
|
-l "no-changelog" \ |
|
|
|
|
|
|
|
--dry-run="$DRY_RUN" \ |
|
|
|
|
|
|
|
-B "$BRANCH" \ |
|
|
|
|
|
|
|
--title "Release: $VERSION" \ |
|
|
|
|
|
|
|
--body "These code changes must be merged after a release is complete" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create PR with backports |
|
|
|
|
|
|
|
if: "${{ inputs.backport != '' }}" |
|
|
|
|
|
|
|
env: |
|
|
|
env: |
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
BRANCH: ${{ steps.branch.outputs.branch }} |
|
|
|
BRANCH: ${{ steps.branch.outputs.branch }} |
|
|
@ -199,7 +184,6 @@ jobs: |
|
|
|
fi |
|
|
|
fi |
|
|
|
gh pr create \ |
|
|
|
gh pr create \ |
|
|
|
"${LATEST_FLAG[@]}" \ |
|
|
|
"${LATEST_FLAG[@]}" \ |
|
|
|
-l "product-approved" \ |
|
|
|
|
|
|
|
-l "no-changelog" \ |
|
|
|
-l "no-changelog" \ |
|
|
|
--dry-run="$DRY_RUN" \ |
|
|
|
--dry-run="$DRY_RUN" \ |
|
|
|
-B "$BRANCH" \ |
|
|
|
-B "$BRANCH" \ |
|
|
|