60 lines
2.3 KiB
YAML
60 lines
2.3 KiB
YAML
name: Bump version
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Needs to match, exactly, the name of a milestone. The version to be released please respect: major.minor.patch, major.minor.patch-preview or major.minor.patch-preview<number> format. example: 7.4.3, 7.4.3-preview or 7.4.3-preview1'
|
|
required: true
|
|
push:
|
|
default: true
|
|
required: false
|
|
dry_run:
|
|
default: false
|
|
required: false
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
|
|
jobs:
|
|
bump-version:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: grafana/shared-workflows/actions/get-vault-secrets@main
|
|
with:
|
|
repo_secrets: |
|
|
GRAFANA_DELIVERY_BOT_APP_PEM=delivery-bot-app:PRIVATE_KEY
|
|
- name: Generate token
|
|
id: generate_token
|
|
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
|
|
with:
|
|
app_id: ${{ vars.DELIVERY_BOT_APP_ID }}
|
|
private_key: ${{ env.GRAFANA_DELIVERY_BOT_APP_PEM }}
|
|
repositories: '["grafana"]'
|
|
permissions: '{"contents": "write", "pull_requests": "write", "workflows": "write"}'
|
|
- name: Checkout Grafana
|
|
uses: actions/checkout@v5
|
|
with:
|
|
token: ${{ steps.generate_token.outputs.token }}
|
|
- name: Update package.json versions
|
|
uses: ./pkg/build/actions/bump-version
|
|
with:
|
|
version: ${{ inputs.version }}
|
|
- if: ${{ inputs.push }}
|
|
name: Push & Create PR
|
|
env:
|
|
VERSION: ${{ inputs.version }}
|
|
DRY_RUN: ${{ inputs.dry_run }}
|
|
REF_NAME: ${{ github.ref_name }}
|
|
RUN_ID: ${{ github.run_id }}
|
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
|
run: |
|
|
git config --local user.name "grafana-delivery-bot[bot]"
|
|
git config --local user.email "grafana-delivery-bot[bot]@users.noreply.github.com"
|
|
git config --local --add --bool push.autoSetupRemote true
|
|
git checkout -b "bump-version/${RUN_ID}/${VERSION}"
|
|
git add .
|
|
git commit -m "bump version ${VERSION}"
|
|
git push
|
|
gh pr create --dry-run="$DRY_RUN" -l "type/ci" -l "no-changelog" -B "$REF_NAME" --title "Release: Bump version to ${VERSION}" --body "Updated version to ${VERSION}"
|