CI: fix release pr target (#90999)

* use inputs.target as checkout ref, and `main` for all reused actions.
This commit is contained in:
Kevin Minehart
2024-07-25 16:14:29 -05:00
committed by GitHub
parent 3137410f3f
commit 2fe506d502
3 changed files with 17 additions and 24 deletions
+2 -1
View File
@@ -62,6 +62,7 @@ jobs:
- name: "Checkout Grafana repo"
uses: "actions/checkout@v4"
with:
ref: main
sparse-checkout: |
.github/workflows
CHANGELOG.md
@@ -123,7 +124,7 @@ jobs:
--label "no-backport" \
--label "no-changelog" \
-B "${{ inputs.target }}" \
--title "Release: ${{ inputs.version }}" \
--title "Release: update changelog for ${{ inputs.version }}" \
--body "Changelog changes for release ${{ inputs.version }}"
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
+15 -8
View File
@@ -59,9 +59,16 @@ jobs:
- name: Checkout Grafana
uses: actions/checkout@v4
with:
ref: ${{ inputs.target }}
fetch-depth: 0
fetch-tags: true
- name: Checkout Grafana (main)
uses: actions/checkout@v4
with:
ref: km/fix-release-pr-target
fetch-depth: '0'
fetch-tags: 'false'
path: .grafana-main
- name: Configure git user
run: |
git config --local user.name "github-actions[bot]"
@@ -70,15 +77,13 @@ jobs:
- name: Create branch
run: git checkout -b "release/${{ github.run_id }}/${{ inputs.version }}"
- name: Generate changelog
id: changelog
uses: ./.github/workflows/actions/changelog
uses: ./.grafana-main/.github/workflows/actions/changelog
with:
github_token: ${{ steps.generate_token.outputs.token }}
target: v${{ inputs.version }}
output_file: changelog_items.md
- name: Patch CHANGELOG.md
run: |
# Prepare CHANGELOG.md content with version delimiters
@@ -112,16 +117,16 @@ jobs:
git diff CHANGELOG.md
- name: Commit CHANGELOG.md changes
run: git commit --allow-empty -m "Update changelog placeholder" CHANGELOG.md
run: git add CHANGELOG.md && git commit --allow-empty -m "Update changelog" CHANGELOG.md
- name: Update package.json versions
uses: ./pkg/build/actions/bump-version
uses: ./.grafana-main/pkg/build/actions/bump-version
with:
version: ${{ inputs.version }}
version: 'patch'
- name: Add package.json changes
run: |
git add .
git add package.json lerna.json yarn.lock packages public
git commit -m "Update version to ${{ inputs.version }}"
- name: Git push
@@ -133,6 +138,7 @@ jobs:
run: >
gh pr create \
$( [ "x${{ inputs.latest }}" == "xtrue" ] && printf %s '-l "release/latest"') \
-l "no-changelog" \
--dry-run=${{ inputs.dry_run }} \
-B "${{ inputs.target }}" \
--title "Release: ${{ inputs.version }}" \
@@ -146,6 +152,7 @@ jobs:
gh pr create \
$( [ "x${{ inputs.latest }}" == "xtrue" ] && printf %s '-l "release/latest"') \
-l "product-approved" \
-l "no-changelog" \
--dry-run=${{ inputs.dry_run }} \
-B "${{ inputs.target }}" \
--title "Release: ${{ inputs.version }}" \